Skip to main content

patera-database

Async SQLAlchemy integration for Patera: databases, request sessions, repositories and transactions. Part of Patera, a modular async-first Python web framework.

Installation

pip install patera-database
# or, with uv
uv add "patera[database]"

Requires Python 3.13 or newer and patera>=0.121.

Usage

patera-database integrates async SQLAlchemy. Install a driver for your database too (aiosqlite is included; e.g. asyncpg for PostgreSQL).

# app/database.py
from sqlalchemy import Integer, String
from sqlalchemy.orm import Mapped, mapped_column

from patera.database.sql import DeclarativeBaseModel, SqlDatabase, SqlDatabaseManager


class MainDb(SqlDatabase):
    __db_name__ = "main"


class Databases(SqlDatabaseManager):
    databases = [MainDb]


class Base(DeclarativeBaseModel):
    __abstract__ = True
    __db_name__ = "main"          # models are bound to a database by name


class Note(Base):
    __tablename__ = "notes"

    id: Mapped[int] = mapped_column(Integer, primary_key=True)
    title: Mapped[str] = mapped_column(String(200))

See the SQL databases section of the Patera documentation for the full guide.

License

MIT. See LICENSE.

Metadata

Release files for patera-database 0.11.1

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

Source distribution (sdist)

Source distribution for patera-database 0.11.1
File Size Uploaded
patera_database-0.11.1.tar.gz 17.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for patera-database 0.11.1
File Interpreter ABI Platform
patera_database-0.11.1-py3-none-any.whl Python 3 none any Details

Total release size: 40.0 kB

Release files / patera_database-0.11.1.tar.gz

Download URL patera_database-0.11.1.tar.gz
Size 17.6 kB
Tags Source
SHA-256 checksum
How to use checksums
d805a0613406de9b7a37940c8c8f71c1df43dd2c5f6dcdca9d965aa3f3d86e17
BLAKE2b-256 checksum
How to use checksums
5e29b333cb80316e973dffe21dd3a7cb6552637870dd453753d40d3b5a983e28
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.11.14 {"installer":{"name":"uv","version":"0.11.14","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release files / patera_database-0.11.1-py3-none-any.whl

Download URL patera_database-0.11.1-py3-none-any.whl
Size 22.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
8ab14971f8f01b5bad5df68cd68dd741c26bfe1df72491ad6558cb50d093dd34
BLAKE2b-256 checksum
How to use checksums
0a101d3149f4c092a9da9d4e71f019e98b56861591ff1f72b5ba47dae3dc4908
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.11.14 {"installer":{"name":"uv","version":"0.11.14","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release history Release notifications | RSS feed

This release

0.11.1 This release

2 release files

0.11.0

2 release files

0.9.0

2 release files

0.8.0

2 release files

0.7.0

2 release files

0.6.1

2 release files

0.6.0

2 release files

0.5.0

2 release files

0.4.11

2 release files

0.4.10

2 release files

0.4.9

2 release files

0.4.8

2 release files

0.4.7

2 release files

0.4.6

2 release files

0.4.5

2 release files

0.4.4

2 release files

0.4.3

2 release files

0.4.2

2 release files

0.4.1

2 release files

0.4.0

2 release files

0.3.0

2 release files

0.2.6

2 release files

0.2.5

2 release files

0.2.4

2 release files

0.2.3

2 release files

0.2.2

2 release files

0.2.0

2 release files

0.1.0

2 release files

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