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.7.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.7.0
File Size Uploaded Provenance Actions
pydantic_sqlite-0.7.0.tar.gz 13.6 kB Without provenance Details for pydantic_sqlite-0.7.0.tar.gz

Built distribution (wheel)

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

Total release size: 28.1 kB

Release files / pydantic_sqlite-0.7.0.tar.gz

Download URL pydantic_sqlite-0.7.0.tar.gz
Size 13.6 kB
Tags Source
SHA-256 checksum
How to use checksums
9a8e18f849ed8301e9e3bf957e88e20d9d3c130cb37da566b2470a601fd35728
BLAKE2b-256 checksum
How to use checksums
eef300f42f43b46ccab797eaa92dc9182b611cf79ed0a5f8a385bc3ac81d4e20
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.12.1 {"installer":{"name":"uv","version":"0.12.1","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"20.04","id":"focal","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

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

Download URL pydantic_sqlite-0.7.0-py3-none-any.whl
Size 14.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d5a558da7b0f3177c0a1afa3244e8ee4118f85089cc74f273c75004b16ded308
BLAKE2b-256 checksum
How to use checksums
b58d89df9eeeec82436bd986bc3a041f61651cb39fef67edd2bca1ddf24b94e3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.12.1 {"installer":{"name":"uv","version":"0.12.1","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"20.04","id":"focal","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Security for pydantic_sqlite 0.7.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