API reference ============= The API is split into the three buckets described in :doc:`layout` — **declarative primitives** at :mod:`codegen_database`, **migration glue** at :mod:`codegen_database.alembic`, and **pre-built features** at :mod:`codegen_database.ext`. Declarative primitives (``codegen_database.*``) --------------------------------------- .. automodule:: codegen_database :no-members: These are the building blocks you compose to describe a schema. .. automodule:: codegen_database.declarative :members: .. automodule:: codegen_database.config :members: .. automodule:: codegen_database.check :members: .. automodule:: codegen_database.index :members: .. automodule:: codegen_database.fk :members: .. automodule:: codegen_database.functions :members: .. automodule:: codegen_database.types :members: :imported-members: :exclude-members: cache_ok, impl .. automodule:: codegen_database.views.view :members: .. automodule:: codegen_database.plugin :members: .. automodule:: codegen_database.extension :members: .. automodule:: codegen_database.pg_extension :members: .. automodule:: codegen_database.validation :members: .. automodule:: codegen_database.errors :members: .. automodule:: codegen_database.validator :members: Factory internals ~~~~~~~~~~~~~~~~~ The resource factories that plugins compose into. Most users interact with these through the built-in plugins rather than directly. .. automodule:: codegen_database.factory.base :members: .. automodule:: codegen_database.factory.context :members: .. automodule:: codegen_database.factory.dimension.simple :members: .. automodule:: codegen_database.factory.dimension.append_only :members: .. automodule:: codegen_database.factory.dimension.eav :members: .. automodule:: codegen_database.factory.ledger :members: Built-in plugins ~~~~~~~~~~~~~~~~ Plugins that ship with codegen_database and power the default factories. .. automodule:: codegen_database.plugins.pk :members: .. automodule:: codegen_database.plugins.column_name :members: .. automodule:: codegen_database.plugins.check :members: .. automodule:: codegen_database.plugins.index :members: .. automodule:: codegen_database.plugins.fk :members: .. automodule:: codegen_database.plugins.ledger :members: .. automodule:: codegen_database.plugins.protect :members: .. automodule:: codegen_database.plugins.soft_delete :members: .. automodule:: codegen_database.plugins.rls :members: .. automodule:: codegen_database.plugins.temporal :members: .. automodule:: codegen_database.plugins.snapshot :members: .. automodule:: codegen_database.plugins.search_vector :members: .. automodule:: codegen_database.plugins.view :members: .. automodule:: codegen_database.plugins.trigger :members: Utilities ~~~~~~~~~ .. automodule:: codegen_database.utils.query :members: Migration glue (``codegen_database.alembic.*``) --------------------------------------- .. automodule:: codegen_database.alembic :no-members: Hooks your project's ``env.py`` wires into Alembic. The comparator/renderer/rewriter modules are internal but documented for reference. .. automodule:: codegen_database.alembic.register :members: .. automodule:: codegen_database.alembic.dependency :members: .. automodule:: codegen_database.alembic.schema :members: .. automodule:: codegen_database.alembic.renderer :members: .. automodule:: codegen_database.alembic.rewriter :members: Pre-built features (``codegen_database.ext.*``) --------------------------------------- .. automodule:: codegen_database.ext :no-members: Opt-in features composed from the primitives above. Each submodule is independent — import only the ones you use. Ledger ~~~~~~ .. automodule:: codegen_database.ext.ledger .. automodule:: codegen_database.ext.ledger.events :members: .. automodule:: codegen_database.ext.ledger.queries :members: .. automodule:: codegen_database.ext.ledger.rollup :members: .. automodule:: codegen_database.ext.ledger.functions :members: .. automodule:: codegen_database.ext.ledger.chart_functions :members: .. automodule:: codegen_database.ext.chart :members: .. automodule:: codegen_database.ext.chart.date_bin :members: Audit ~~~~~ .. automodule:: codegen_database.ext.audit :members: .. automodule:: codegen_database.ext.audit.queries :members: .. automodule:: codegen_database.ext.audit.activity :members: Comments ~~~~~~~~ .. automodule:: codegen_database.ext.comments :members: .. automodule:: codegen_database.ext.comments.queries :members: State machines ~~~~~~~~~~~~~~ .. automodule:: codegen_database.ext.state_machine :members: Incremental refresh ~~~~~~~~~~~~~~~~~~~ .. automodule:: codegen_database.ext.refresh.plugin :members: .. automodule:: codegen_database.ext.refresh.query :members: Cron ~~~~ .. automodule:: codegen_database.ext.pg_cron :members: .. automodule:: codegen_database.ext.cron.base :members: .. automodule:: codegen_database.ext.cron.compare :members: PostGIS ~~~~~~~ .. automodule:: codegen_database.ext.postgis :members: PostGISExtension Row-level security ~~~~~~~~~~~~~~~~~~ .. automodule:: codegen_database.ext.rls.alembic :members: