sqlite3dict
Wrapper around sqlite3 which allows working simply with python dictionaries as well as combining it with sql syntax.
Installation
Use the package manager pip to install sqlite3dict.
pip install sqlite3dict
Usage
from sqlite3dict import Storage
from datetime import datetime
# ******************************************************************************
# * Test
# ******************************************************************************
with Storage("test.sqlite") as store:
definitions = {
"name": "TEXT",
"age": "INTEGER",
"amount": "DOUBLE",
"createdate": "DATETIME",
"resident": "BOOLEAN"
}
# This creates the table (collection) only if it does not exist already
collection = store.init_collection("test", definitions)
# Insert data
collection.insert({
"name": "John Doe",
"age": 25,
"amount": 100.23,
"createdate": datetime.now(),
"resident": True,
"additional": {
"prop1": 1,
"prop2": 1,
"other": ["A", "B"]
}
})
collection.insert({
"name": "John Doe",
"age": 10,
"amount": 100.00,
"createdate": datetime.now(),
"resident": True
})
# Update inserted data by given criteria
collection.update().data({
"createdate": datetime.now(),
"age": 15,
"amount": 99.38,
"resident": False
}).where("age = 25").execute()
# Simple query for data
list = collection.query().where("age = 15").limit(10).offset(0).order("createdate", "ASC").order("ID").execute()
for item in list:
print("item:", item)
# Delete data by given criteria
collection.delete().where("age = 15").execute()
# Native SQL query in case you still need it
items = store.query_native("select * from test")
for item in items:
print("native item:", item)
# Drop table (collection)
store.delete_collection("test")
Contributing
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
License
Metadata
Release files for sqlite3dict 1.0.1
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 | |
|---|---|---|---|---|
| sqlite3dict-1.0.1.tar.gz | 6.9 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| sqlite3dict-1.0.1-py2.py3-none-any.whl | Python 2, Python 3 | none | any | Details |
Total release size: 16.5 kB
Release files / sqlite3dict-1.0.1.tar.gz
| Download URL | sqlite3dict-1.0.1.tar.gz |
|---|---|
| Size | 6.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
9cc282a9ff3edc9567ac62f53a4a9ad65e5a55161d4b3479de2452f9b0baa3f2
|
|
BLAKE2b-256 checksum How to use checksums |
115233f537996c3b55f4b8bd2d2990c49e13e66fcd29dbc5bdcd8aebebb0398a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/45.2.0 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.8.1
|
Release files / sqlite3dict-1.0.1-py2.py3-none-any.whl
| Download URL | sqlite3dict-1.0.1-py2.py3-none-any.whl |
|---|---|
| Size | 9.6 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
27a3b1d54b162a256be421e864e9f010252ec5c119edae36e10464f4d6a18833
|
|
BLAKE2b-256 checksum How to use checksums |
c1b6b00c0da8870b815c71171baebe2354115d0d1877b26077003df01c05c307
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/45.2.0 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.8.1
|
Security for sqlite3dict 1.0.1
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.