You can use sqlacodegen to generate the classes needed for sqlalchemy.
pip install sqlacodegen
sqlacodegen postgresql+psycopg2://username:password@host/database --outfile models.py
I ran into an issue with the Base class and the query attribute. The error I received was:
AttributeError: type object 'PaymentType' has no attribute 'query'
I was able to make the sqlacodegen classes work by using a scoped_session.
session = scoped_session(sessionmaker(autocommit=False,autoflush=False,bind=engine))
Base.query = session.query_property()
print(PaymentType.query.all())