Skip to main content

aiosqlite + strict pydantic models

Project description

aiosqlite-strict

Strict Pydantic models on top of aiosqlite.

Install

pip install aiosqlite-strict

Usage

import asyncio

import aiosqlite
from aiosqlite_strict import TableModel

class AppTable(TableModel):
    ...

class User(AppTable):
    __indices__ = [("name",)]

    name: str
    email: str

async def main() -> None:
    async with aiosqlite.connect(":memory:") as db:
        await AppTable.sqlite_init(db)

        user1 = await User.create(db, name="name1", email="email1")
        _ = await User.create(db, name="name2", email="email2")

        async with User.select(db) as cursor:
            print(await cursor.fetchall())

        await user1.update_one(db, name="name1.1")

        async with User.select(db, "WHERE name=?", ("name1.1",)) as cursor:
            print(await cursor.fetchall())

asyncio.run(main())

Development

uv run pytest

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

aiosqlite_strict-1.0.12.tar.gz (8.7 kB view details)

Uploaded Source

Built Distribution

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

aiosqlite_strict-1.0.12-py3-none-any.whl (7.4 kB view details)

Uploaded Python 3

File details

Details for the file aiosqlite_strict-1.0.12.tar.gz.

File metadata

  • Download URL: aiosqlite_strict-1.0.12.tar.gz
  • Upload date:
  • Size: 8.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.2 {"installer":{"name":"uv","version":"0.10.2","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for aiosqlite_strict-1.0.12.tar.gz
Algorithm Hash digest
SHA256 b396e1058a42ba1cb551782fee41acb4dd11502ac9f206e99e6defff550e6741
MD5 bf8c12e758a5df3d1789342c78339c15
BLAKE2b-256 9fd149f99b61b69994bfa1c602eb45ec60c0e706e2c001856ce104a3dbb782f3

See more details on using hashes here.

File details

Details for the file aiosqlite_strict-1.0.12-py3-none-any.whl.

File metadata

  • Download URL: aiosqlite_strict-1.0.12-py3-none-any.whl
  • Upload date:
  • Size: 7.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.2 {"installer":{"name":"uv","version":"0.10.2","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for aiosqlite_strict-1.0.12-py3-none-any.whl
Algorithm Hash digest
SHA256 82c01e0f5bc4ec0727555e6e186b9eb9be2982320c13d3d107f46ab0f74431f9
MD5 5acb968a190f392e26fab75a83b98562
BLAKE2b-256 66c41df6cab6ce91d97fe4ee6dda0912fce183df8f63ce13b511ea33a68385e6

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