Search code examples
postgresqlsqlalchemyschemadefaultsqlacodegen

How to set default schema through URL in SQLAlchemy.create_engine for postgresql


I tried to make a python models for my flask application with sqlacodegen .

and my database is postgresql in AWS_RDS .

so I tried like below

sqlacodegen postgresql://{RDS_USERNAME}:{RDS_PASSWORD}@{RDS_HOSTNAME}:{RDS_PORT}/{RDS_DB_NAME}'

but it just works with my default schema in postgresql RDS_DB_NAME

I want information of other schemas which are not set as default TT.


Solution

  • I Solved!!

    I found that sqlacodegen has args option --schema

    So, I made a commend as below

    sqlacodegen --schema public_test URL