rethinkdb / rethinkdb

The open-source database for the realtime web.
https://rethinkdb.com
Other
26.76k stars 1.86k forks source link

python drivers support db-url schemas #4101

Open digi604 opened 9 years ago

digi604 commented 9 years ago

Please support dburl schemas for connections.

[protocol]://[node]/[database]?[options]

this would be something like:

rethinkdb://myhost:1234/myDB

danielmewes commented 9 years ago

Since this is pretty common in other DBs, I think it would be useful (it could be a separate connect optarg url: ...).

I cannot promise how quickly we'll get to this, but we'll keep it on our list.

Also marking as good_for_contributors.

sidthekidder commented 8 years ago

Hey, I'd like to start contributing to RethinkDB and this seems a good first issue. I would basically have to modify the init function of CommonOptionsParser in utils_common.py right, to check for a url opt?

NotJustAnna commented 4 years ago

Implemented it on the Java driver, on the develop/experimental branch.

gabor-boros commented 4 years ago

Also, we should support all the connection options through the URL except SSL, so: host, port, db, auth_key, user, password, timeout

In this case a connection string would look like rethinkdb://user:password@myhost:1234/myDB?auth_key=mykey&timeout=20 where user, password, auth_key and timeout are optional but the other is required (the connection string posted is an example and not working because both auth_key and password are set).

Example

>>> from rethinkdb import r
>>> url = "rethinkdb://admin@127.0.0.1:28015/test?timeout=30"
>>> conn = r.connect(url=url)
NotJustAnna commented 4 years ago

Also, I'd suggest adding the db-url syntax to docs, so the driver's documentation can just point to the page on the docs.

gabor-boros commented 4 years ago

@adriantodt I agree to add the syntax to the docs. The only question is when do we want to release that "feature"/syntax change to the users. I mean ship it with the 2.5.0 release or before? Also, if we extend the docs and add the syntax change to the drivers' API documentation, what do you mean by "driver's documentation can just point to the page on the docs"?

NotJustAnna commented 4 years ago

The only question is when do we want to release that "feature"/syntax change to the users. I mean ship it with the 2.5.0 release or before?

There's just so much stuff going on that there's already enough to do a 2.4.1 release for Java and Python drivers, and maybe minor server stuff as well?

what do you mean by "driver's documentation can just point to the page on the docs"?

Java documentation is just sugared HTML, I can point the users that use db-url with a http link into the site documentation.

gabor-boros commented 4 years ago

As a side note, the python driver is at 2.4.4, because the idea there was to keep 2.4 but the patch version. So 2.4.5 for python, and 2.4.1 for ruby, JavaScript and Java could work I think