sqla-utils
Opinionated utilities for working with SQLAlchemy
Contents
Transaction Wrapper
FIXME
DBObjectBase
DBObjectBase is a base class for mapped classes.
Example:
from datetime import datetime
from sqlalchemy import Column, DateTime, Integer, String
from sqla_utils import DBObjectBase, Transaction
class DBAppointment(DBObjectBase):
__tablename__ = "appointments"
id = Column(Integer, primary_key=True)
date = Column(DateTime, nullable=False)
description = Column(String(1000), nullable=False, default="")
Appointment items can then be queried like this:
from sqla_utils import begin_transaction
with begin_transaction() as t:
app123 = DBAppointment.fetch_by_id(t, 123)
great_apps = DBAppointment.fetch_all(t, DBAppointment.description.like("%great%"))
It is recommended to add custom query, creation, and update methods:
class DBAppointment(DBObjectBase):
...
@classmethod
def create(cls, t: Transaction, date: datetime, description: str) -> DBAppointment:
o = cls()
o.date = date
o.description = description
t.add(o)
return o
@classmethod
def fetch_all_after(cls, t: Transaction, date: datetime) -> List[DBAppointment]:
return cls.fetch_all(t, cls.start >= dates.start)
def update_description(self, t: Transaction, new_description: str) -> None:
self.description = new_description
t.changed(self)
Database Builder
FIXME
pytest Utilities
The sqla_utils.test module contains a few utilities for working with pytest and SQLAlchemy.
FIXME
Metadata
Release files for sqla-utils 0.9.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| sqla_utils-0.9.0.tar.gz | 13.5 kB | Without provenance | Details for sqla_utils-0.9.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| sqla_utils-0.9.0-py3-none-any.whl | Python 3 | none | any | Details for sqla_utils-0.9.0-py3-none-any.whl |
Total release size: 28.4 kB
Release files / sqla_utils-0.9.0.tar.gz
| Download URL | sqla_utils-0.9.0.tar.gz |
|---|---|
| Size | 13.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
b73ab5821f46a83a70c730b8eb4d680c3760703cd78755a2d5818752c4d4687d
|
|
BLAKE2b-256 checksum How to use checksums |
9f0a53ee612dd0af7271fd491490b8b7d2294995cc8a2939cd52c76c0c51c0eb
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.10.12 {"installer":{"name":"uv","version":"0.10.12","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Release files / sqla_utils-0.9.0-py3-none-any.whl
| Download URL | sqla_utils-0.9.0-py3-none-any.whl |
|---|---|
| Size | 14.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
ebdeef01c99e8815ab1727877fa1180a63b335bc029297f51370ac455e7f562c
|
|
BLAKE2b-256 checksum How to use checksums |
0bda00d3f2eb2b454952c0d3db04397c003f9a0b4f11823bfab453ed6a5049f0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.10.12 {"installer":{"name":"uv","version":"0.10.12","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Security for sqla-utils 0.9.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.