PerFact API - SQLAlchemy base for models
Project description
perfact-api-base-model
SQLAlchemy declarative base for all PerFact API models. Part of the perfact.api.base namespace.
What it provides
Base
Declarative base for all ORM table mappings. Subclasses automatically get:
id—BigIntegerprimary keymodtime—DateTimewith timezone, defaults tonow()author— set from the DB session user viadb_username()- Column names are automatically prefixed with the table name (e.g. a field
nameonAppUserbecomes the DB columnappuser_name) __tablename__is derived from the class name in lowercase if not set explicitly
View
Separate declarative base for SQL view definitions. Views are not created as tables during schema generation. Columns must be declared with explicit names matching the view definition.
Re-exports
ForeignKey, relationship, Mapped, mapped_column are re-exported so model packages only need to import from this module.
Usage
from perfact.api.base.model import Base, ForeignKey, Mapped, mapped_column, relationship
class MyEntity(Base):
name: Mapped[str]
parent_id: Mapped[int | None] = mapped_column(ForeignKey("myentity.myentity_id"))
Dependencies
sqlalchemypsycopg[c]pydantic-settings
Maintainers
- Viktor Dick viktor.dick@perfact.de
- Alexander Rolfes alexander.rolfes@perfact.de
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 perfact_api_base_model-0.2.tar.gz.
File metadata
- Download URL: perfact_api_base_model-0.2.tar.gz
- Upload date:
- Size: 4.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
42c5318f355a4adf20eafc938a6402355e73c045bf7e1f690d6767d8fc3649f2
|
|
| MD5 |
569bd311da9174630db9527a9d694d1d
|
|
| BLAKE2b-256 |
4b8d0ed4c13f65156ced21125976c98910a884e98d169f42fe06b6993040daf4
|
File details
Details for the file perfact_api_base_model-0.2-py2.py3-none-any.whl.
File metadata
- Download URL: perfact_api_base_model-0.2-py2.py3-none-any.whl
- Upload date:
- Size: 3.2 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fd36f2301e6fd5ddab984293741c6b01698406d3acfc69a549e844efc94ee72a
|
|
| MD5 |
dd14a30442781c107429527112826714
|
|
| BLAKE2b-256 |
8937b1456808e1fc9205ecea920290330d9a8a5c2549a3c37d1ba3a69e3e4cd4
|