0

I have a database with nearly 100 tables. I am trying to use alembic to manage it in python. Is there a way for alembic to build the ORM python files for me or do I have to write them myself.

For example in the database there is a user table with columns id, first_name, last_name, email is there a way alembic can pull this from the database and basically write the following file for me:

from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy import Column, Integer, String, ForeignKey
​
Base = declarative_base()
​
class User(Base):
   __tablename__ = 'user'
​
   id = Column(Integer, primary_key=True)
   first_name = Column(String)
   last_name = Column(String)
   email = Column(String)

Thanks

Nick
  • 46
  • 4

0 Answers0