sqlalchemy-postgresql-materialized-views
sqlalchemy-postgresql-materialized-views copied to clipboard
When is the view created?
HI Jeff,
This is a very nice article, thank you for taking your time to write it. Looking at the code, I was wondering if the materialized view needs to be created manually in advance in the database or it will be automatically created by the model. I cannot figure out where (and how) is the execution of 'CREATE MATERIALIZED VIEW ....'.
Thank you
It's executed when your models are created, so whatever way you're triggering instantiation of your other SQLAlchemy models would trigger this. Notice that MaterializedView class subclasses the SQLAlchemy Model class, so that's what hooks in.