How to use sqlcodegen generate SQLModels

161 views
Skip to first unread message

Linson Abah

unread,
Mar 22, 2023, 6:55:20 PM3/22/23
to sqlalchemy
Hi,
I am trying to convert the schema of a db to SQLModels: I have this short script:

from subprocess import call
outfile = 'models/dvdrental_models.py'
generator = 'sqlmodels'
call(['sqlacodegen', db_uri, '--generator', generator, '--outfile', outfile])

I got this Error.
sqlacodegen: error: unrecognized arguments: --generator sqlmodels

How do I modify this to work correctly? 

Thank you

Mike Bayer

unread,
Mar 22, 2023, 7:45:46 PM3/22/23
to noreply-spamdigest via sqlalchemy
hey there-

--
SQLAlchemy -
The Python SQL Toolkit and Object Relational Mapper
 
 
To post example code, please provide an MCVE: Minimal, Complete, and Verifiable Example. See http://stackoverflow.com/help/mcve for a full description.
---
You received this message because you are subscribed to the Google Groups "sqlalchemy" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sqlalchemy+...@googlegroups.com.

Val Huber

unread,
Mar 22, 2023, 7:51:41 PM3/22/23
to sqlalchemy
You might want to consider API Logic Server.  It includes sqlacodegen, and uses it to build an executable project including an API and an Admin App.
Reply all
Reply to author
Forward
0 new messages