Python module to management `dataclass` objects using SQLite
Project description
daacla
Python module to management dataclass objects using SQLite
Usage
from dataclasses import dataclass
from datetime import datetime
from daacla import Daacla, table
@dataclass
@table(key='url') # `key` means primary key
class Post: # makes `Post` table on the `db` database
url: str
created_at: float
db = Daacla()
# Update/Insert a record
db.upsert(Post(url='https://example.com/page/1', created_at=datetime.now().timestamp()))
# Check existence of the record
print( db.exists(Post, key='https://example.com/page/1') ) # → True
# Check existence of the record
print( db.exists(Post, key='https://example.com/page/NOTHING') ) # → False
# Search
url = 'https://example.com/page/1'
for post in db.select(Post, 'url = ?', url):
print(post.url) # → https://example.com/page/1
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
daacla-0.0.7.tar.gz
(5.3 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file daacla-0.0.7.tar.gz.
File metadata
- Download URL: daacla-0.0.7.tar.gz
- Upload date:
- Size: 5.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.7.1 importlib_metadata/4.10.1 pkginfo/1.8.2 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ce8b2991525da6b3599616ec2280fe9bf5c5d7ffc7556e5ae3f6c41ff924a419
|
|
| MD5 |
b0195edcdc40060675f499e820758bfe
|
|
| BLAKE2b-256 |
cda4b3789509db0de5bdc2105f9f54c95b9c9c83afd276b02b4cd03fb0838d5c
|
File details
Details for the file daacla-0.0.7-py3-none-any.whl.
File metadata
- Download URL: daacla-0.0.7-py3-none-any.whl
- Upload date:
- Size: 5.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.7.1 importlib_metadata/4.10.1 pkginfo/1.8.2 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9861c2b3aadf56bbae6a1e8a06e759a66882a39ff7acf7f7d441e49dee6823a1
|
|
| MD5 |
021c47e9bec42e6605a235b04ef840da
|
|
| BLAKE2b-256 |
c2f0b80a18cc629aeb84b06261a7351daf398814758fc0832e3c78cf11a3e263
|