I have a database with a few tables in schema_a and views of these tables in schema_b, and want to use alembic revision --autogenerate
to run have alembic detect the views i've created.
When I run alembic revision --autogenerate
either using metadata with models.py generated from sqlacodegen
my views are represented as tables in the resultant code. Ideally I would like to create a migration that represents the current state of the database, as it was initialized using handmade SQL for all the views and tables. When I look into the autogenerated migrations, i see discrepancies between schemas and views/tables as mentioned. Is there anyway to get a MetaData()
object for a running PSQL database instead of relying on models.py
metadata object (which doesnt seem to be correct)?