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(name="name1", email="email1").insert(db)
        _ = await User(name="name2", email="email2").insert(db)

        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.14.tar.gz (8.9 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.14-py3-none-any.whl (7.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: aiosqlite_strict-1.0.14.tar.gz
  • Upload date:
  • Size: 8.9 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.14.tar.gz
Algorithm Hash digest
SHA256 c295c886cdd1273a2bed0cb344d65ecf27c2bf061b38d884c583e45a100fc52e
MD5 dafb916b7558f1eabf4d3049e038be19
BLAKE2b-256 b6d8c8952df16068430b44359fdac0afb8711c4f2418f4e659a13a406194cc23

See more details on using hashes here.

File details

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

File metadata

  • Download URL: aiosqlite_strict-1.0.14-py3-none-any.whl
  • Upload date:
  • Size: 7.5 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.14-py3-none-any.whl
Algorithm Hash digest
SHA256 23cdb2e7d25940432291b6398f19a80feaf231b93b87ef9965e13ad344f8a388
MD5 ee1ddbbc876b7692649c9abd72e8ca9b
BLAKE2b-256 088018455baa94cfc67d55959e9cc9300aeeed009a7c3573de07cad130f17c19

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