Pyramid SQLAlchemy Integration
Project description
pyramid-sa
Pyramid SQLAlchemy Integration — a reusable library that wires SQLAlchemy into any Pyramid application.
Features
- Session management — engine, transaction-managed sessions,
request.dbsession - Declarative base —
Basewith naming conventions and utility methods (as_dict,copy_with) - Audit trail — opt-in
AuditMixintracking created/updated by whom and when - Soft delete — opt-in
SoftDeleteMixinwith query filtering, unique indexes, and safe restore - Error mapping —
NoResultFound→ 404,IntegrityError→ 409, with customizable bodies - JSON rendering —
datetime,date,UUIDadapters out of the box - Alembic scaffold —
db init-alembicfor pre-wired migration setup - CLI commands —
db drop,db initializefor schema management - Test fixtures — companion
pyramid-sa-testingpackage with PostgreSQL-backed pytest plugin
Documentation
Full documentation is available at tomascorrea.github.io/pyramid-sa.
- Getting Started — installation, app factory wiring, what
includesets up - Models —
BasevsModel,as_dict(),copy_with(), mixins - Database & Migrations — Alembic scaffold, CLI commands,
env.pysetup - Audit Trail —
AuditMixincolumns and automatic field population - Soft Delete —
SoftDeleteMixin, filtering, unique indexes, restore - Error Handling — exception tween, custom error formatters
- Testing — pytest fixtures, transaction isolation,
conftest.pysetup - API Reference — full public API by module
Installation
pip install pyramid-sa
For test fixtures (dev only):
pip install pyramid-sa-testing
Quick Start
Wire pyramid-sa into your Pyramid app factory:
from pyramid.config import Configurator
def create_app(global_config=None, dbengine=None, **settings):
config = Configurator(settings=settings)
if dbengine is not None:
config.registry["dbengine"] = dbengine
config.include("pyramid_sa")
config.sa_enable_audit() # optional: auto-populate audit fields
config.sa_enable_soft_delete() # optional: soft-delete behavior
config.sa_scan_models("myapp.models")
config.scan(".views")
return config.make_wsgi_app()
See Getting Started for a full walkthrough of what config.include("pyramid_sa") sets up, model definitions, and next steps.
Development
uv sync --dev
uv run pytest
uv run ruff check .
uv run black .
License
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pyramid_sa-0.7.2.tar.gz.
File metadata
- Download URL: pyramid_sa-0.7.2.tar.gz
- Upload date:
- Size: 93.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
56d8350d4723697a232c4a00e53c9cbc4a0a4dc47372d8aa637dea404011b112
|
|
| MD5 |
ce62af06445be41fdedcc165180ba9c3
|
|
| BLAKE2b-256 |
cc489a1862b60428bc7dc9a7a7ddc9bf908fc1f22e26cd8b035914dc570e0326
|
Provenance
The following attestation bundles were made for pyramid_sa-0.7.2.tar.gz:
Publisher:
ci.yml on tomascorrea/pyramid-sa
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pyramid_sa-0.7.2.tar.gz -
Subject digest:
56d8350d4723697a232c4a00e53c9cbc4a0a4dc47372d8aa637dea404011b112 - Sigstore transparency entry: 1155484443
- Sigstore integration time:
-
Permalink:
tomascorrea/pyramid-sa@9501bf15f381fc88ff4cd1159021fb18c6b0212e -
Branch / Tag:
refs/tags/v0.7.2 - Owner: https://github.com/tomascorrea
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
ci.yml@9501bf15f381fc88ff4cd1159021fb18c6b0212e -
Trigger Event:
release
-
Statement type:
File details
Details for the file pyramid_sa-0.7.2-py3-none-any.whl.
File metadata
- Download URL: pyramid_sa-0.7.2-py3-none-any.whl
- Upload date:
- Size: 15.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6d5f88051311962a9b5a3685106ed9aa35f5a236ebd5b8cfd8a318323d5d0205
|
|
| MD5 |
11776fd6e9eba337ec531c88e2e0d2d9
|
|
| BLAKE2b-256 |
db7c576a54f3038dda6bf81d980ac3db56049078cd5ada6e5aff1611cbf069ec
|
Provenance
The following attestation bundles were made for pyramid_sa-0.7.2-py3-none-any.whl:
Publisher:
ci.yml on tomascorrea/pyramid-sa
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pyramid_sa-0.7.2-py3-none-any.whl -
Subject digest:
6d5f88051311962a9b5a3685106ed9aa35f5a236ebd5b8cfd8a318323d5d0205 - Sigstore transparency entry: 1155484451
- Sigstore integration time:
-
Permalink:
tomascorrea/pyramid-sa@9501bf15f381fc88ff4cd1159021fb18c6b0212e -
Branch / Tag:
refs/tags/v0.7.2 - Owner: https://github.com/tomascorrea
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
ci.yml@9501bf15f381fc88ff4cd1159021fb18c6b0212e -
Trigger Event:
release
-
Statement type: