Convenient Wrapper around AioSQL and a Database Connection
Project description
AnoDB
Convenient Wrapper around aiosql and a Database Connection.
Description
This class creates a persistent database connection and imports SQL queries from a file.
If the connection is broken, a new connection is attempted.
Compared do aiosql, the point is not to need to pass a connection as an argument on each call.
Example
import anodb
db = anodb.DB('sqlite3', 'test.db', 'test.sql')
db.do_some_insert(key=1, val='hello')
db.do_some_update(key=1, val='world')
db.commit()
db.close()
With file test.sql
containing something like:
-- name: do_some_insert!
INSERT INTO Stuff(key, val) VALUES (:key, :val);
-- name: do_some_update!
UPDATE Stuff SET val = :val WHERE key = :key;
Versions
Sources are available on GitHub.
2.1
Make cursor
reconnect if needed.
Add automatic reconnection tests.
2.0
Swith from AnoSQL to AioSQL.
1.3
Make options
accept different types.
Make queries
optional, and allow to load from files or strings.
1.2
Add options
string parameter to constructor.
1.1
Add **conn_options
parameter to constructor.
Add cursor()
method.
1.0
Initial release.
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
Built Distribution
File details
Details for the file anodb-2.1.0.tar.gz
.
File metadata
- Download URL: anodb-2.1.0.tar.gz
- Upload date:
- Size: 4.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.4.2 requests/2.22.0 setuptools/45.2.0 requests-toolbelt/0.8.0 tqdm/4.30.0 CPython/3.8.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 342c4a06bd6161dd62945c9f22a9042def17956518a9eff9e746cb56a109687c |
|
MD5 | ec3a54cc055cad8c5f2e3ae4b77e738c |
|
BLAKE2b-256 | 89c7f10cf16e404c7d39dac86a48cd4514ce5d967318207444368febc942270b |
Provenance
File details
Details for the file anodb-2.1.0-py3-none-any.whl
.
File metadata
- Download URL: anodb-2.1.0-py3-none-any.whl
- Upload date:
- Size: 4.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.4.2 requests/2.22.0 setuptools/45.2.0 requests-toolbelt/0.8.0 tqdm/4.30.0 CPython/3.8.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d9140b5c0bb6b5534385e41dda435455afcedeb26608f80351a8cd19bdec1818 |
|
MD5 | 7356edafb8bc92c76830e894a312a8ec |
|
BLAKE2b-256 | 6e2c7c69cdfd8912fd23156fa53c16a901ab41c122bafdd490f1213013affc09 |