Auto Generate sqlachemy models from yml file or dicts

87 views
Skip to first unread message

David Boateng Adams

unread,
Jul 3, 2022, 9:15:03 AM7/3/22
to sqlalchemy
I want to be able to auto generate sqlalchemy model from a schema.
So I have the schema in yaml format.
From that file, I load it and get the columns and its data type  and also the schema name into a dict. And I want to use that dictionary to create the sqlalchemy model  not just a normal python class

I have done some research and I see you can use sqlachemy's automap feature to do what I want but that is when you supply a DB connection uri. Likewise sqlacodegen

Val Huber

unread,
Jul 3, 2022, 8:11:36 PM7/3/22
to sqlalchemy
Hi, David...

ApiLogicServer bundles a version of sqlacodegen, and creates the models.py file (along with a running project).  Don't know if this fits your needs, hope it helps.
Reply all
Reply to author
Forward
0 new messages