Skip to main content

Context manager for Sqlite databases

Project description


SQLITE 3 CM is a context manager, 😃 A way TO USE with statement on sqlite databases !! (WITHOUT CLOSING OR OPENING ANYTING 🤩)

Install 📦

pip install sqlite3cm

Docs 📄

from sqlite3cm import OpenSqlite3db

with OpenSqlite3db("database.db", throw_error=True) as (conn, cursor):
    conn.execute('CREATE TABLE IF NOT EXISTS users')


You shouldn't forget about the parentisis after the as


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)


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

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.3.tar.gz (2.4 kB view hashes)

Uploaded source

Built Distribution

sqlite3cm-0.0.3-py3-none-any.whl (2.8 kB view hashes)

Uploaded py3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page