diff options
author | Antoine Pitrou <solipsis@pitrou.net> | 2013-02-09 23:02:44 (GMT) |
---|---|---|
committer | Antoine Pitrou <solipsis@pitrou.net> | 2013-02-09 23:02:44 (GMT) |
commit | 902fc8b5a0035cc95f6d849f759577f9d315caaf (patch) | |
tree | 76fc231932346ba359e0de8a4cb0fce4e892c361 /Doc | |
parent | 8ad5b07ccb81f51551ac087a5409ebc85c0d16a7 (diff) | |
download | cpython-902fc8b5a0035cc95f6d849f759577f9d315caaf.zip cpython-902fc8b5a0035cc95f6d849f759577f9d315caaf.tar.gz cpython-902fc8b5a0035cc95f6d849f759577f9d315caaf.tar.bz2 |
Issue #13773: sqlite3.connect() gets a new `uri` parameter to pass the filename as a URI, allowing to pass custom options.
Diffstat (limited to 'Doc')
-rw-r--r-- | Doc/library/sqlite3.rst | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/Doc/library/sqlite3.rst b/Doc/library/sqlite3.rst index e31ae77..00d3c16 100644 --- a/Doc/library/sqlite3.rst +++ b/Doc/library/sqlite3.rst @@ -159,7 +159,7 @@ Module functions and constants first blank for the column name: the column name would simply be "x". -.. function:: connect(database[, timeout, detect_types, isolation_level, check_same_thread, factory, cached_statements]) +.. function:: connect(database[, timeout, detect_types, isolation_level, check_same_thread, factory, cached_statements, uri]) Opens a connection to the SQLite database file *database*. You can use ``":memory:"`` to open a database connection to a database that resides in RAM @@ -195,6 +195,18 @@ Module functions and constants for the connection, you can set the *cached_statements* parameter. The currently implemented default is to cache 100 statements. + If *uri* is true, *database* is interpreted as a URI. This allows you + to specify options. For example, to open a database in read-only mode + you can use:: + + db = sqlite3.connect('file:path/to/database?mode=ro', uri=True) + + More information about this feature, including a list of recognized options, can + be found in the `SQLite URI documentation <http://www.sqlite.org/uri.html>`_. + + .. versionchanged:: 3.4 + Added the *uri* parameter. + .. function:: register_converter(typename, callable) |