AttributeError: ‘Identity’ object has no attribute ‘arg’ …
How can i fix this in flask with sqlcodegen …by using below command file is created but it through an error …
sqlacodegen postgresql://postgres:Sasi2312@localhost/c4gt_local --outfile models.py
commadn not works …I have tried with a file ..attached below both are not works
import io
import sys
from sqlalchemy import create_engine, MetaData
from sqlacodegen.codegen import CodeGenerator
def generate_model(host, user, password, database, outfile = None):
engine = create_engine(f'postgresql+psycopg2://{user}:{password}@{host}/{database}')
metadata = MetaData(bind=engine)
metadata.reflect()
outfile = io.open(outfile, 'w', encoding='utf-8') if outfile else sys.stdout
generator = CodeGenerator(metadata)
generator.render(outfile)
if __name__ == '__main__':
generate_model('localhost', 'postgres', 'Sasi2312', 'c4gt_local', 'dbss.py')
Anyone have a solution to solve this error …..or my need is to create models in flask …I already have tables in postgresql …by using any packages i need models of those tables
sasikumar s is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.