Skip to main content

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')
print("data", db.do_some_select(key=1))
db.commit()

db.close()

With file test.sql containing something like:

-- name: do_some_select
SELECT * FROM Stuff WHERE key = :key;

-- 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.2

Setup explicit logger instead of relying on default.

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

anodb-2.2.0.tar.gz (4.3 kB view details)

Uploaded Source

Built Distribution

anodb-2.2.0-py3-none-any.whl (4.4 kB view details)

Uploaded Python 3

File details

Details for the file anodb-2.2.0.tar.gz.

File metadata

  • Download URL: anodb-2.2.0.tar.gz
  • Upload date:
  • Size: 4.3 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

Hashes for anodb-2.2.0.tar.gz
Algorithm Hash digest
SHA256 5a3b593920bd26ec440ae13182e6e96822553e75ccaef13b0857a8f436352b37
MD5 60b6822b3cd8ed8ff4eb57fdb4289653
BLAKE2b-256 caeeac8b5d93c57d2edf7f6d20f2a03bdfc99a48c83673e13746388e408642c5

See more details on using hashes here.

Provenance

File details

Details for the file anodb-2.2.0-py3-none-any.whl.

File metadata

  • Download URL: anodb-2.2.0-py3-none-any.whl
  • Upload date:
  • Size: 4.4 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

Hashes for anodb-2.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 1db318b9063f8ff5d927d8a319c9c57bfcf084215500e99f3ec862d31c37d516
MD5 f1f507c2541eceb2ab74ad444d0863ff
BLAKE2b-256 4a74fde6e5932e75e9a46adba5e9ea82be464086f133e1f79b0e2e55a5d97c28

See more details on using hashes here.

Provenance

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