mirror of
https://github.com/simonw/sqlite-utils.git
synced 2026-09-13 03:54:23 +02:00
feat: add URI filename support
This commit is contained in:
parent
c479ca0f44
commit
37ef98352a
5 changed files with 308 additions and 48 deletions
|
|
@ -93,6 +93,16 @@ Instead of a file path you can pass in an existing SQLite connection:
|
|||
|
||||
db = Database(sqlite3.connect("my_database.db"))
|
||||
|
||||
You can also use `SQLite URI filenames <https://www.sqlite.org/uri.html>`__ to open databases with special parameters:
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
# Open database in read-only mode
|
||||
db = Database("file:data.db?mode=ro")
|
||||
|
||||
# Open as read-only and immutable
|
||||
db = Database("file:data.db?mode=ro&immutable=1")
|
||||
|
||||
If you want to create an in-memory database, you can do so like this:
|
||||
|
||||
.. code-block:: python
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue