Skip to main content

Generate FastAPI route modules from SQLAlchemy-backed ExDataset metadata.

Project description

exdrf-gen-al2r

exdrf-gen-al2r is an exdrf-gen plugin that emits FastAPI APIRouter stubs from SQLAlchemy-backed ExDataset metadata. List and read handlers are typed with XxxEx; create uses XxxCreate. Patch is emitted only when exdrf-gen-al2pd would emit XxxEdit (composite PK–only link tables skip PATCH). The SCHEMAS-PKG argument must point at the package tree produced by al2pd.

Python 3.12.2+ is required.

Command-line usage

exdrf-gen al2r DATASET OUT-PATH DB-MODULE SCHEMAS-PKG

Or: python -m exdrf_gen al2r ....

  • DATASETmodule.path:DeclarativeBase.
  • OUT-PATH — directory for *_routes.py and __init__.py (or EXDRF_AL2R_PATH).
  • DB-MODULE — dotted import path for ORM classes (from DB-MODULE import Model).
  • SCHEMAS-PKG — dotted root package where al2pd wrote schemas (or EXDRF_AL2R_SCHEMAS). Import path per resource is SCHEMAS-PKG.<categories...>.<snake_case_name_plural> (e.g. myapp.schemas.widgets for Widget at the root category).

Path parameters for GET/PATCH follow resource.primary_fields() order (e.g. {left_id}/{right_id} for composite keys).

Dependencies

exdrf-gen, exdrf-al, click, exdrf-gen-al2pd (for resource_generates_edit_payload). Generated routers import FastAPI and SQLAlchemy — add those to the application environment.

Plugin registration

[project.entry-points.'exdrf.plugins']
exdrf_gen = 'exdrf_gen_al2r'

See also

  • exdrf-gen-al2pd — generates the Pydantic modules al2r imports.
  • exdrf-genREADME.md.

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

exdrf_gen_al2r-0.1.15.tar.gz (19.0 kB view details)

Uploaded Source

Built Distribution

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

exdrf_gen_al2r-0.1.15-py3-none-any.whl (22.2 kB view details)

Uploaded Python 3

File details

Details for the file exdrf_gen_al2r-0.1.15.tar.gz.

File metadata

  • Download URL: exdrf_gen_al2r-0.1.15.tar.gz
  • Upload date:
  • Size: 19.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for exdrf_gen_al2r-0.1.15.tar.gz
Algorithm Hash digest
SHA256 7f78d755355acfaf7a11df419b0b3ad9eac4b1b17bd3108ddd0978cff8b5bdaf
MD5 55e499949a9fbd9e9ad33a1ddd4a9dc4
BLAKE2b-256 ec60b72def90e0b20d0be347aa090c8e5bc8a2f0cc24e569aae09067828a49a7

See more details on using hashes here.

File details

Details for the file exdrf_gen_al2r-0.1.15-py3-none-any.whl.

File metadata

File hashes

Hashes for exdrf_gen_al2r-0.1.15-py3-none-any.whl
Algorithm Hash digest
SHA256 a0cc9661652a19fc294e4a0dd0afc937f324f5f651dab04e4edd52ba99fa294b
MD5 8559a6309bae74016e4c655ddd328a9b
BLAKE2b-256 fbe9282c34941d96fc0d2daa4efb2f06889d715361d6cf9b9a0fe40f87265c21

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