-
Notifications
You must be signed in to change notification settings - Fork 37
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Empty datacenter name causes table create to fail #131
Comments
No worries at all, glad to help out! I just got off the train, I'll be at
|
I am seeing issues as well when using connection.Run instead of connection.RunAsync:
And here's the inner exception detail/stacktrace:
Here's the code I used (slightly modified to add a basic Movie class:
Thanks for pointing this out, @jchannon. @mfenniak later on in the day I will try to dive into this a bit more, I need to get to work right now. |
Glad its not just me. Is that the correct API to use when adding data? I know its always an issue on OSS to get docs written |
Take a look at this test: https://github.com/mfenniak/rethinkdb-net/blob/master/rethinkdb-net-test/Integration/TableTests.cs#L23 (sorry for the long link, not sure if there's a better way to link to source code lines within github) Typically create a reference to a Table object:
Then call Insert method and pass it an object, like this line: https://github.com/mfenniak/rethinkdb-net/blob/master/rethinkdb-net-test/Integration/TableTests.cs#L71-L86
That being said, your call should work, I would imagine. |
Cool, thanks. Is there a need to use Query.Db("test")? I see node.js allows you to setup a default db that it uses but this is where maybe the libs diverge. |
"test" database is created on a new install of rethinkdb (AFAIK). It's just something to use for, testing :-) We use it in the integration tests on the CI server. It's just another On Wed, Sep 18, 2013 at 10:11 AM, Jonathan Channon <notifications@github.com
|
Sorry I meant the need to specify the database on every call |
No worries. If you use that reference style that I linked to then no, you won't need to On Wed, Sep 18, 2013 at 10:15 AM, Jonathan Channon <notifications@github.com
|
@jchannon Until we get some documentation in place, browsing the tests is a good resource on how to use the API. |
Understood |
You can store an instance of the Query.Db("...").Table("....") queries in a variable, field, or static field to reduce the amount of references you need to make these queries. Note that this might just conflict with what I said in the other issue about not referencing the QueryTerm namespace directly, since your variables might need those types. I'd consider that a bug in the API design; I'd eventually replace those direct references with interfaces. 😀 |
The error:
is caused by using an empty string as the datacenter name in the TableCreate query. The error is misleading as it describes the "Database name" as being invalid, but that's the error we're getting back from RethinkDB. If you change out the "" parameter for null, or use Query.Db(...).TableCreate(...) use the default value of null, this error goes away. We could validate this client-side before issuing our query... but we don't do any validation along those lines so far. Or, we could treat nulls and empty strings as equivalent in our null-check in TableCreateQuery.cs. |
Ahhh, good catch, @mfenniak. On Wed, Sep 18, 2013 at 8:45 PM, Mathieu Fenniak
|
As you can probably tell, I'm completely new to Rethink and am using the node.js API docs to udnerstand it.
I have the below but it fails saying the db name is "" when it tries to do the
connection.Run(addTable);
The text was updated successfully, but these errors were encountered: