Skip to main content

pydantic-sqlite

Python License: MIT codecov

Pydantic SQLite

pydantic-sqlite makes it easy to store Pydantic models directly in a SQLite database and retrieve fully-typed objects -> no manual serialization.

pydantic-sqlite bridges the gap between Pydantic models and SQLite persistence. Instead of manually mapping your models to database columns or writing SQL, you work directly with your Pydantic BaseModel instances. The library automatically handles serialization and deserialization. You can store BaseModel instancea directly in the database, and when querying, you always get back fully reconstructed, ready-to-use Pydantic objects—just like your originals.

Documentation and Examples

For documentation, and examples, visit: pydantic-sqlite Documentation

Installation

Using pip

pip install pydantic-sqlite

Using uv

uv add pydantic-sqlite

Using poetry

poetry add pydantic-sqlite

Quick Start

from pydantic import BaseModel
from pydantic_sqlite import DataBase

class Person(BaseModel):
    uuid: str
    name: str
    age: int

# Create a database
db = DataBase()

# Add a person - just pass your model instance
person = Person(uuid="1", name="Alice", age=30)
db.add("Persons", person)

# Retrieve all people - you get back Person instances, not raw rows
for person in db("Persons"):
    print(f"{person.name} is {person.age} years old")
    assert isinstance(person, Person)  # ✓ True

Support

License

MIT – See LICENSE for details.

Metadata

Release files for pydantic_sqlite 0.6.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pydantic_sqlite 0.6.0
File Size Uploaded Provenance Actions
pydantic_sqlite-0.6.0.tar.gz 11.3 kB Without provenance Details for pydantic_sqlite-0.6.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for pydantic_sqlite 0.6.0
File Interpreter ABI Platform Actions
pydantic_sqlite-0.6.0-py3-none-any.whl Python 3 none any Details for pydantic_sqlite-0.6.0-py3-none-any.whl

Total release size: 23.5 kB

Release files / pydantic_sqlite-0.6.0.tar.gz

Download URL pydantic_sqlite-0.6.0.tar.gz
Size 11.3 kB
Tags Source
SHA-256 checksum
How to use checksums
88ff3400df11ab35310e8d9732c633c6ba7a1eb4b5b1f029456def12cee1c822
BLAKE2b-256 checksum
How to use checksums
130d7a8715841f5b8ee4774bf60fe672e51e8481220f25e7a10eb957a96ae0a9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.12.5 {"installer":{"name":"uv","version":"0.12.5","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / pydantic_sqlite-0.6.0-py3-none-any.whl

Download URL pydantic_sqlite-0.6.0-py3-none-any.whl
Size 12.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
5c7048a6d92680dd75a9b59f975f2970810a17cfcc55740a6efb776e381ec7ce
BLAKE2b-256 checksum
How to use checksums
b41ef64cc732b6ab65b709d3d30900bbbe793a419e14f271a7589178199fc832
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.12.5 {"installer":{"name":"uv","version":"0.12.5","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Security for pydantic_sqlite 0.6.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page