SQLAlchemy Converter¶
inverter provides converter from dataclass to SQLAlchemy ORM model.
Currently, only PostgreSQL compatible model is can be generated.
-
inverter.dc2pgsqla.convert(schema, metadata, *, name=None) → sqlalchemy.sql.schema.Table¶ Convert
dataclasstosqlalchemyORM model- Parameters
schema –
dataclassclassmetadata –
sqlalchemy.MetaDataobjectname – model name
- Returns
sqlalchemyORM class
Field metadata handling
primary_key: bool- primary key flagindex: bool- flag on whether to index the columnautoincrement: bool- flag on whether to make column autoincrementunique: bool- flag on whether to make column uniquesearchable: bool- flag on whether to make column searchable using PGSQL Trigramformat: str- format of data:uuid,text,fulltextindex,bigint,numeric. This forces SQLAlchemy to use specific data type for the format.