Skip to main content

PerFact API - SQLAlchemy base for models

This project has been archived.

The maintainers of this project have marked this project as archived. No new releases are expected.

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:

  • idBigInteger primary key
  • modtimeDateTime with timezone, defaults to now()
  • author — set from the DB session user via db_username()
  • Column names are automatically prefixed with the table name (e.g. a field name on AppUser becomes the DB column appuser_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

  • sqlalchemy
  • psycopg[c]
  • pydantic-settings

Maintainers

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

perfact_api_base_model-0.5.tar.gz (5.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

perfact_api_base_model-0.5-py2.py3-none-any.whl (4.6 kB view details)

Uploaded Python 2Python 3

File details

Details for the file perfact_api_base_model-0.5.tar.gz.

File metadata

  • Download URL: perfact_api_base_model-0.5.tar.gz
  • Upload date:
  • Size: 5.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.5

File hashes

Hashes for perfact_api_base_model-0.5.tar.gz
Algorithm Hash digest
SHA256 62e1b08f2f007b5c5a6b2295c0b5571edfe756ca5404dbef54395c28143732aa
MD5 de891d1159cac7460ddfc35b2846b575
BLAKE2b-256 c5814d1741f64d48034a9a31ef492dac30014df4360b02d8024f7c79329c045b

See more details on using hashes here.

File details

Details for the file perfact_api_base_model-0.5-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for perfact_api_base_model-0.5-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 537892166997b79ea8898990ac621ebf8d3cacc69d31eaf5ac82fb2deb441b3a
MD5 2b87c27e15f0afd22d82ecf989bb17cd
BLAKE2b-256 a3ffe51490886ef196bac00f1b0eda15ddfe395c046bc6b660699918384555c4

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page