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.6.tar.gz
(5.0 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.6.tar.gz.
File metadata
- Download URL: daacla-0.0.6.tar.gz
- Upload date:
- Size: 5.0 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.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
66ee0c58c731dc0e6d51cf30c0aab56d07df390300348072e6b7a61bb074c71c
|
|
| MD5 |
746b146f12af425acd184657c0f1b3bc
|
|
| BLAKE2b-256 |
6c50082608c91b2230958a7227cfec71f975dd5b943c0af7414d50119a50f3a0
|
File details
Details for the file daacla-0.0.6-py3-none-any.whl.
File metadata
- Download URL: daacla-0.0.6-py3-none-any.whl
- Upload date:
- Size: 5.4 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.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8ded0f906b1c37516967cd348abccb318f3d08d04498d6ea85ba1cbf6bb8541d
|
|
| MD5 |
406b0c2d342a4022c59ab3a010ec6b40
|
|
| BLAKE2b-256 |
412b76e34ce9a9f60205803c6d2d3b62856e6f6b1cdedc679bdf821fa2e65e00
|