mirror of
https://github.com/python/cpython.git
synced 2025-08-04 17:08:35 +00:00
Issue #13773: sqlite3.connect() gets a new uri
parameter to pass the filename as a URI, allowing to pass custom options.
This commit is contained in:
parent
8ad5b07ccb
commit
902fc8b5a0
5 changed files with 67 additions and 8 deletions
|
@ -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)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue