Skip to content

Expected type DATUM but found DATABASE #1880

Closed

Description

@l1x

While I am trying insert data to a database I am getting the the following error:

{:error :runtime-error, :token 110, 
:response ("Expected type DATUM but found DATABASE:\ndb(\"metrics\")"), :backtrace 
{:frames [{:type :pos, :pos 0} {:type :pos, :pos 0}]}}

I use the Clojure library for the insert.

; [db table data timeout]
(insert-table "metrics" "90abdcf519745e69053939a0a86bf087" {:id 1390161960, :host "ec2-50-2-3-1.compute-1.amazonaws.com", :proc.stat.cpu.user 34, :proc.stat.cpu.idle 37} 15000)

I am just wondering that these sort of issues happen because there is a mismatch between the protobuf version between the client and the server?

Here is the pro to file for the client.

https://github.com/bitemyapp/revise/blob/master/resources/proto/rethinkdb.proto

Versions:

rethinkdb 1.11.3 (CLANG 5.0 (clang-500.2.79))
revise 0.0.5

I can insert data through the web UI fine.

r.db("metrics")
.table("90abdcf519745e69053939a0a86bf087")
.insert({"host":"host","proc.stat.cpu.user":10,"proc.stat.cpu.idle":90,"id":1})

Thank you in advance.

Activity

  1. danielmewes commented on Jan 20, 2014

    @danielmewes
    Member

    Hi @l1x . This does not look like a protocol buffer mismatch.
    What is the query you are running in Clojure? I suspect that something is wrong with the query, or maybe how it is interpreted by the driver.

  2. danielmewes commented on Jan 20, 2014

    @danielmewes
    Member

    Oh never mind. This is the query isn't it?

    (insert-table "metrics" "90abdcf519745e69053939a0a86bf087" {:id 1390161960, :host "ec2-50-2-3-1.compute-1.amazonaws.com", :proc.stat.cpu.user 34, :proc.stat.cpu.idle 37} 15000)
    

    Is insert-table something defined by the driver or did you define it? I'm not familiar with the Revise driver unfortunately.

  3. l1x commented on Jan 20, 2014

    @l1x
    Author

    Hey Daniel,

    thanks for answering. Here is the insert-table function what I have defined:

     (defn insert-table
        [db table data timeout]
        (-> (r/db db)
            (r/table table)
            (r/insert data)
            (run local-connection timeout)))
    
  4. neumino commented on Jan 20, 2014

    @neumino
    Member

    @l1x I'm not really good at Clojure (and that's an euphemism), but it should be table-db instead of table I think,

     (defn insert-table
        [db table data timeout]
        (-> (r/db db)
            (r/table-db table)
            (r/insert data)
            (run local-connection timeout)))
    
    
  5. l1x commented on Jan 20, 2014

    @l1x
    Author

    Thank you guys, actually it seems that the r/insert needs the r/db somehow else but I was able to insert data fiddling with functions I am using. It is definitely not a protobuf issue. Good to be closed.

  6. l1x commented on Jan 20, 2014

    @l1x
    Author

    @neumino You are right man, it was a typo in that function, using r/table-db solves the problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions