Thread-safe SQLite3 worker for Python
Project description
sqlite-worker
Sqlite-Worker is a Python package providing a thread-safe interface for SQLite database operations. It ensures safe concurrent access to SQLite databases and simplifies executing database queries from different threads.
Features
- Thread-safe SQLite database operations
- Queue-based query execution
- Simple and easy-to-use API
Installation
To install do the following:
pip3 install sqlite-worker
Creating a Worker Instance
Create an instance of Sqlite3Worker by specifying the path to your SQLite database file:
worker = Sqlite3Worker("/path/to/your/database.db")
Execute Queries
Creating a table
worker.execute("CREATE TABLE example (id INTEGER PRIMARY KEY, name TEXT)")
Inserting data
worker.execute("INSERT INTO example (name) VALUES (?)", ("Alice",))
Fetching data
results = worker.execute("SELECT * FROM example")
print(results)
Closing the Worker
After completing all database operations, close the worker to ensure proper cleanup:
worker.close()
Contributing
Contributions to the Sqlite-Worker are welcome! Please refer to the project's issues and pull request sections for contributions.
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
sqlite-worker-0.0.2.tar.gz
(2.7 kB
view hashes)
Built Distribution
Close
Hashes for sqlite_worker-0.0.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 97529ebef3e1c01c2a6994e49656583d839e58bd4c45c95a95e44e89f45a54ce |
|
MD5 | 5deae3f8eb378baea3949544f684bccf |
|
BLAKE2b-256 | 7ebe93dffd8a6ff004b27126d254e73ed726b0182776de89ec79cf892cc1d1b5 |