Context manager for Sqlite databases
Project description
SQLITE3 CM
SQLITE 3 CM is a context manager,
😃
A way TO USE with
statement on sqlite databases !! (WITHOUT CLOSING OR OPENING ANYTING 🤩)
Docs 📄
from sqlite3cm import OpenSqlite3db
with OpenSqlite3db("database.db", throw_error=True) as (conn, cursor):
conn.execute('CREATE TABLE IF NOT EXISTS users')
Note:
You shouldn't forget about the parentisis after the as
Arguments
db_path
Path to the database (can be Pathlib
path) (default to "database.db")
throw_error
Weather you want to throw an error or not (default to True)
Note:
None of these arguments are required.
Lightness 🕊
THE SCRIPT IS ONLY 20 LINES LONG 😄 (50 with docstrings and comments)
Features 🧪
At the beggining, the script will connect to the database and create a cursor
At the end, the script will commit, close the connection and cursor
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
sqlite3cm-0.0.2.tar.gz
(1.8 kB
view hashes)
Built Distribution
Close
Hashes for sqlite3cm-0.0.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c01993989d55248e15372f359b39f9a85c389a7de8479286bd8ca7af9da86290 |
|
MD5 | 3f4420aed49664e304feaea7ad718ceb |
|
BLAKE2b-256 | 5d35b15137ef2de109788f4d7b34dd4923f68c2e363fff2bdf6a2d6da0ac3db6 |