msg151089 - (view) |
Author: (poq) |
Date: 2012-01-11 20:33 |
URIs are an extensible way to pass options to SQLite. See:
http://www.sqlite.org/uri.html
Patch adds a keyword argument "uri" to sqlite3.connect which causes the filename to be parsed as a URI if set to True.
|
msg151090 - (view) |
Author: Amaury Forgeot d'Arc (amaury.forgeotdarc) *  |
Date: 2012-01-11 21:07 |
Hi, I will let others discuss the feature itself, here are already some comments about your patch:
- In module_connect(), the ability to pass "factory" as a positional argument is broken, please restore the previous code; I'm afraid there is no better implementation, even if it's a copy of connection.__init__.
- I suggest to allow "uri" in all builds, and fail only when it's True on a non supported platform.
- In general, try to wrap C code in 80 columns (except for the ".. function::" directive in .rst files)
- IIRC a correct URI is file:///path/to/file but sqlite probably allows file:/path/to/file as well.
- The test function should use "from test.support import TESTFN" to get a temporary file name (but I agree that sqlite tests don't seem to follow Python standards)
|
msg151097 - (view) |
Author: (poq) |
Date: 2012-01-11 22:44 |
Thanks for your comments. You're right, I didn't consider positional arguments. Here's a patch that addresses your comments.
Should I also rewrap modified lines that were already much too long?
I also noticed & fixed an unrelated typo in Lib/sqlite3/test/hooks.py...
|
msg152521 - (view) |
Author: Éric Araujo (eric.araujo) *  |
Date: 2012-02-03 14:45 |
> Should I also rewrap modified lines that were already much too long?
Please don’t, it would make the diff harder to read.
> I also noticed & fixed an unrelated typo in Lib/sqlite3/test/hooks.py...
Can you open a bug report for that?
I think the doc could link to the sqlite.org doc about URIs.
|
msg152549 - (view) |
Author: (poq) |
Date: 2012-02-03 18:54 |
> Can you open a bug report for that?
Opened #13934.
> I think the doc could link to the sqlite.org doc about URIs.
I considered this, but the rest of the sqlite3 module documentation doesn't link to the sqlite.org doc pages either. There is only a link to http://www.sqlite.org under 'See also'.
|
msg152595 - (view) |
Author: Éric Araujo (eric.araujo) *  |
Date: 2012-02-04 07:18 |
[Amaury]
> The test function should use "from test.support import TESTFN" to get
> a temporary file name
I believe that TESTFN predates tempfile (and the tempfile helpers in regrtest and test.support) and is now seen as an ugly relic (at least by me :)
[poq]
>> I think the doc could link to the sqlite.org doc about URIs.
> I considered this, but the rest of the sqlite3 module documentation doesn't link to the
> sqlite.org doc pages either.
Well, users need a way to find the list of allowed options. The Python docs should either list them (there aren’t much; pro: all the info is here, con: maintenance) or link to them.
By the way, do you want to give us your full name so that we can credit you? (And on a related subject, I don’t know if this small patch requires a contributor agreement.)
|
msg152640 - (view) |
Author: (poq) |
Date: 2012-02-04 18:51 |
> The Python docs should either list them (there aren’t much; pro: all the info is here, con: maintenance) or link to them.
They've already added a new option ('psow') since I opened this report, so linking is probably more future-proof.
I've added an updated patch which adds a link. I've also changed the exception when URIs are not supported to sqlite3.NotSupportedError.
> By the way, do you want to give us your full name so that we can credit you?
I prefer anonymity. :)
|
msg152672 - (view) |
Author: Éric Araujo (eric.araujo) *  |
Date: 2012-02-05 10:15 |
> I've added an updated patch which adds a link. I've also changed the exception when URIs
> are not supported to sqlite3.NotSupportedError.
Sounds good. Note to the person who will commit: :const:`True` should be marked up as ``True.``
> I prefer anonymity. :)
OK. I’m still not sure if a contributor agreement is needed for this patch.
|
msg170297 - (view) |
Author: André Anjos (anjos) |
Date: 2012-09-11 12:13 |
A question concerning this patch: is this going to be applied only to 3.3 or to 2.7 as well? Python-2.7.x also does not have this functionality which would be interesting to get.
|
msg170311 - (view) |
Author: Éric Araujo (eric.araujo) *  |
Date: 2012-09-11 15:02 |
2.7 and 3.2 are stable versions which only get bug fixes. 3.3 is in release candidate stage, so this new feature can only go into 3.4. See the devguide and PEPs for more info about the process we follow.
|
msg180025 - (view) |
Author: Antoine Pitrou (pitrou) *  |
Date: 2013-01-15 15:59 |
This would definitely be useful. I would have liked to have this feature today.
poq, could you sign a contributor agreement?
See http://www.python.org/psf/contrib/
Also, it's better if you can use a real name (or at least a well-known pseudonym).
|
msg181556 - (view) |
Author: Antoine Pitrou (pitrou) *  |
Date: 2013-02-06 18:35 |
Here is an updated patch.
|
msg181769 - (view) |
Author: Roundup Robot (python-dev)  |
Date: 2013-02-09 23:06 |
New changeset f13bb1e40fbc by Antoine Pitrou in branch 'default':
Issue #13773: sqlite3.connect() gets a new `uri` parameter to pass the filename as a URI, allowing to pass custom options.
http://hg.python.org/cpython/rev/f13bb1e40fbc
|
msg181770 - (view) |
Author: Antoine Pitrou (pitrou) *  |
Date: 2013-02-09 23:07 |
I've committed the patch, closing.
|
msg181779 - (view) |
Author: Serhiy Storchaka (serhiy.storchaka) *  |
Date: 2013-02-10 09:08 |
You can use "p" format in PyArg_ParseTuple* for boolean parameters.
|
msg181784 - (view) |
Author: Antoine Pitrou (pitrou) *  |
Date: 2013-02-10 11:00 |
> You can use "p" format in PyArg_ParseTuple* for boolean parameters.
That's what I used, indeed.
|
msg181801 - (view) |
Author: Serhiy Storchaka (serhiy.storchaka) *  |
Date: 2013-02-10 13:23 |
Oh, I were blind.
|
|
Date |
User |
Action |
Args |
2022-04-11 14:57:25 | admin | set | github: 57982 |
2013-02-10 13:23:53 | serhiy.storchaka | set | messages:
+ msg181801 |
2013-02-10 11:00:34 | pitrou | set | messages:
+ msg181784 |
2013-02-10 09:08:11 | serhiy.storchaka | set | nosy:
+ serhiy.storchaka messages:
+ msg181779
|
2013-02-09 23:07:47 | pitrou | set | status: open -> closed messages:
+ msg181770
assignee: ghaering -> resolution: fixed stage: patch review -> resolved |
2013-02-09 23:06:56 | python-dev | set | nosy:
+ python-dev messages:
+ msg181769
|
2013-02-06 18:35:55 | pitrou | set | files:
+ sqlite_open_uri.patch
messages:
+ msg181556 |
2013-01-15 15:59:29 | pitrou | set | messages:
+ msg180025 |
2013-01-15 15:57:32 | pitrou | set | nosy:
+ pitrou
|
2012-09-11 15:02:41 | eric.araujo | set | messages:
+ msg170311 versions:
+ Python 3.4, - Python 3.3 |
2012-09-11 12:13:49 | anjos | set | nosy:
+ anjos messages:
+ msg170297
|
2012-02-05 10:15:05 | eric.araujo | set | messages:
+ msg152672 |
2012-02-04 18:51:50 | poq | set | files:
+ sqlite-uri.v3.patch
messages:
+ msg152640 |
2012-02-04 07:18:08 | eric.araujo | set | messages:
+ msg152595 |
2012-02-03 18:54:47 | poq | set | messages:
+ msg152549 |
2012-02-03 14:45:18 | eric.araujo | set | messages:
+ msg152521 |
2012-01-14 03:57:45 | eric.araujo | set | assignee: ghaering
nosy:
+ eric.araujo, ghaering |
2012-01-11 22:44:08 | poq | set | files:
+ sqlite-uri.v2.patch
messages:
+ msg151097 |
2012-01-11 21:07:34 | amaury.forgeotdarc | set | nosy:
+ amaury.forgeotdarc
messages:
+ msg151090 stage: patch review |
2012-01-11 20:33:18 | poq | create | |