-
Notifications
You must be signed in to change notification settings - Fork 262
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support SQLite URI mode and arguments #196
Comments
Any update on this? |
nvjoshi2
pushed a commit
to irulast/databases
that referenced
this issue
Jan 23, 2022
nvjoshi2
pushed a commit
to irulast/databases
that referenced
this issue
Jan 24, 2022
zanieb
added a commit
that referenced
this issue
Aug 2, 2023
* add support for sqlite connection string query parameters, cached memory databases * add additional comments #196 * tweaked comments #196 * Lint --------- Co-authored-by: Nathan Joshi <[email protected]>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Background
In sqlite3, if you set
uri=True
, you can pass query param arguments to the underlying database, including options likecache=shared
andmode=memory
, which are useful for unit testing (you can create an in-memory DB which stays alive between multiple connections).For example, without the query params,
:memory:
databases are completely separate:But if we pass
cache=shared
, they're shared:mode=memory
lets you create named memory DB's so you can share them by name instead of having a single shared namespace.The problem
The problem is that
databases
handles query params itself and doesn't pass them to the underlying connection:Proposed solutions
I messed around with this locally and come up with this solution:
... which basically just passes options through, but it doesn't seem to match how other backends work (with kwargs and URL query params being treated identically).
If you wanted to make options and kwargs interchangeable, you could do something like:
I can make a PR if that would be helpful but I'm not really sure how to approach this.
This would provide a workaround to fix #75
The text was updated successfully, but these errors were encountered: