This project is deprecated since the class Database exists in the library Shared
Litedao
Intuitive interaction with SQLite database
This project is part of the Pyrustic Ecosystem.
Installation | Reference | Shared
Overview
Here is an example of an interaction with an SQL database:
from litedao import Litedao
# Database path (if this file does not exist, it will be created)
DATABASE_PATH = "/home/alex/litedao_test.db"
# SQL code to initialize the database
INIT_SCRIPT = """\
CREATE TABLE friend (username TEXT PRIMARY KEY, email TEXT NOT NULL);
CREATE TABLE enemy (username TEXT PRIMARY KEY, email TEXT NOT NULL)"""
# Insertion SQL code
INSERTION_SQL = """\
INSERT INTO friend (username, email)
VALUES (?, ?), (?, ?)"""
# Selection SQL code
SELECTION_SQL = "SELECT * from friend"
def insert_data(litedao):
# inserts data in the database then returns a boolean
return litedao.edit(INSERTION_SQL, param=("alex", "alex@earth.invalid",
"rustic", "rustic@earth.invalid"))
def select_data(litedao):
# returns the selection
return litedao.query(SELECTION_SQL)
# litedao instance
litedao = Litedao(DATABASE_PATH, init_script=INIT_SCRIPT)
# insert data if this database is newly created
if litedao.is_new:
insert_data(litedao)
selection = select_data(litedao)
tables = litedao.tables()
columns = litedao.columns("friend")
litedao.close() # if you forget to close Litedao, it will close itself at exit
print(selection)
# output: (['username', 'email'], [('alex', 'alex@earth.invalid'), ('rustic', 'rustic@earth.invalid')])
print(tables)
# output: ['friend', 'enemy']
print(columns)
# output: [(0, 'username', 'TEXT', 0, None, 1), (1, 'email', 'TEXT', 1, None, 0)]
Read the reference !
Do you need to store data collections with another simpler paradigm ? Check Shared !
Installation
pip install litedao
Metadata
Release files for litedao 0.0.7
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 |
|---|---|---|---|---|
| litedao-0.0.7.tar.gz | 5.9 kB | Without provenance | Details for litedao-0.0.7.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| litedao-0.0.7-py3-none-any.whl | Python 3 | none | any | Details for litedao-0.0.7-py3-none-any.whl |
Total release size: 15.7 kB
Release files / litedao-0.0.7.tar.gz
| Download URL | litedao-0.0.7.tar.gz |
|---|---|
| Size | 5.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
74ea066877aff86a04d5c8e607b8bf5098cb45cc3d18711fcc151ce9bb62857c
|
|
BLAKE2b-256 checksum How to use checksums |
546f15be947d39898b253609d521ea57bcc0e6911c88653b4cb101e0cedb3252
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.15.0 pkginfo/1.6.1 requests/2.9.1 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.54.0 CPython/3.5.2
|
Release files / litedao-0.0.7-py3-none-any.whl
| Download URL | litedao-0.0.7-py3-none-any.whl |
|---|---|
| Size | 9.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
532ecde63ea5dc17783a35256a525042870d8dc5d63016e8bcb0ca6b57d2afea
|
|
BLAKE2b-256 checksum How to use checksums |
f430ff1440f73ec7b7648004c73af11f97425a388c374d12dbcb2e3b450776a6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.15.0 pkginfo/1.6.1 requests/2.9.1 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.54.0 CPython/3.5.2
|
Security for litedao 0.0.7
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.