ansqlite
A python3 module to assist in small sqlite3 database use cases.
Install
python3 -m pip install ansqlite
Usage
from ansqlite import Database, Datatype, PrimaryKeyType, TableColumn
tablename = 'tablename'
db = Database(
database_path='/path/to/database/file.db',
schemas={
tablename: [
TableColumn(
name="timestamp",
datatype=Datatype.INTEGER,
primary_key=PrimaryKeyType.Descending
),
TableColumn(
name="value",
datatype=Datatype.REAL
),
],
'othertablename': [
TableColumn(
name="hash",
datatype=Datatype.TEXT,
),
TableColumn(
name="text",
datatype=Datatype.TEXT
),
],
'anothertablename': [
TableColumn(
name="id",
datatype=Datatype.INTEGER,
primary_key=PrimaryKeyType.Autoincrementing
),
TableColumn(
name="text",
datatype=Datatype.TEXT
),
],
}
)
db.insert_data(
table_name=tablename,
data=[
{'timestamp': 1699304400, 'value': 4.496},
{'timestamp': 1699300800, 'value': 6.812},
{'timestamp': 1699297200, 'value': 7.847},
{'timestamp': 1699293600, 'value': 9.548}
]
)
db.execute_and_commit(
sql=f'UPDATE {tablename} SET value=1.00 WHERE timestamp=1699300800;',
errmsg='Failed to set value'
)
rows = db.execute_and_fetchall(
sql=f'SELECT * FROM {tablename} where timestamp >= 1699297200 and timestamp < 1699304400 limit 10;',
errmsg='Failed to retrieve data',
result_model=db.get_model(tablename),
)
print(rows)
Metadata
Release files for ansqlite 0.4.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| ansqlite-0.4.2.tar.gz | 4.5 kB | Without provenance | Details for ansqlite-0.4.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| ansqlite-0.4.2-py3-none-any.whl | Python 3 | none | any | Details for ansqlite-0.4.2-py3-none-any.whl |
Total release size: 9.9 kB
Release files / ansqlite-0.4.2.tar.gz
| Download URL | ansqlite-0.4.2.tar.gz |
|---|---|
| Size | 4.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
75751074b6e80de73f2aaffe0961883c064a3edea2cf050bda55c2fa4aacc7d4
|
|
BLAKE2b-256 checksum How to use checksums |
a633c549eb32eccaeaa31719a77d5958c980cbc0ac4b267ac798953498d2b351
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.11.9
|
Release files / ansqlite-0.4.2-py3-none-any.whl
| Download URL | ansqlite-0.4.2-py3-none-any.whl |
|---|---|
| Size | 5.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
68384902aebb03c8fde561c81aab9b125447bc93e3ffd7fa1b669f7cc2159583
|
|
BLAKE2b-256 checksum How to use checksums |
be872fbba3e21522066ad459a1c05dfb26ea0919a202d9ad49c34100aafad250
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.11.9
|
Security for ansqlite 0.4.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.