sqlalchemy-postgresql-materialized-views icon indicating copy to clipboard operation
sqlalchemy-postgresql-materialized-views copied to clipboard

When is the view created?

Open rgeos opened this issue 9 years ago • 1 comments

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

rgeos avatar Oct 24 '17 09:10 rgeos

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.

jeffwidman avatar Oct 30 '17 20:10 jeffwidman