Skip to main content

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.8.tar.gz (6.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

daacla-0.0.8-py3-none-any.whl (6.5 kB view details)

Uploaded Python 3

File details

Details for the file daacla-0.0.8.tar.gz.

File metadata

  • Download URL: daacla-0.0.8.tar.gz
  • Upload date:
  • Size: 6.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.13

File hashes

Hashes for daacla-0.0.8.tar.gz
Algorithm Hash digest
SHA256 ec81d969e5d127dfc36682fb84acdc858f6c52396c98529439d6ad04ffc6b08e
MD5 b12016cf6adf4fc82bac69c09a623445
BLAKE2b-256 ec432cc3405877357bef7a23f839c47251d0a365d08ab2ab3b5b8b49d2b0ace9

See more details on using hashes here.

File details

Details for the file daacla-0.0.8-py3-none-any.whl.

File metadata

  • Download URL: daacla-0.0.8-py3-none-any.whl
  • Upload date:
  • Size: 6.5 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

Hashes for daacla-0.0.8-py3-none-any.whl
Algorithm Hash digest
SHA256 46afa8769849da07fce99e3589cadd7ffc667b9b1ede58495875f90e5a6ff880
MD5 4f5cf6d267eacfc52c7da33c0727bebd
BLAKE2b-256 694e7f679417c3bcc2b7575aa9fc8fe8cb4b5ba11fc6e915e7d3f6202eff5c8d

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page