We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Add __enter__ and __exit__ methods for db, table and column classes to make possible nice temporary connection.
__enter__
__exit__
from sqllex import SQLite3x with SQLite3x('/path/database.db') as db: # creting connection db.insert(...) ... # commit and disconnection with SQLite3x('/path/database.db').connection as conn: # creting connection # doing things (idk) ... # commit and disconnection with SQLite3x('/path/database.db')['table'] as table: # creting connection table.insert(...) table.select(...) # commit and disconnection with SQLite3x('/path/database.db')['table']['column'] as column: # creting connection column.find(...) # commit and disconnection (if necessary)
P.S.: For developers, stackoverflow "Implementing use of 'with object as o' in custom class in python"
The text was updated successfully, but these errors were encountered:
v0.2.0.4
fa5c549
- Added feature to set optional sqlite3 connection parameters #57 - Added option to desable connetion with Database object init #56 - [IN PROGRESS] "With-as" statement #55 - Fixed BUG | Typing mistakes #51 - Docs update Co-Authored-By: Phizilion <[email protected]>
After a few tries I'm just not sure is this really so necessary and what is the bes way to code it 😅.
Sorry, something went wrong.
No branches or pull requests
Add
__enter__
and__exit__
methods for db, table and column classes to make possible nice temporary connection.P.S.: For developers, stackoverflow "Implementing use of 'with object as o' in custom class in python"
The text was updated successfully, but these errors were encountered: