-
Notifications
You must be signed in to change notification settings - Fork 63
Open
Description
Hi there
I have a materialized view defined using PGMaterializedView in a views.py file. The views had already been created in the database.
I want to now add a unique index to my view - can I do this in the definition of a PGMaterializedView and manage the update with alembic?
As a minimal example:
my_view = PGMaterializedView (
schema="public",
signature="vw_period_totals",
definition="""
SELECT
id,
name,
period,
sum(count) AS total
FROM table
GROUP BY id, name, period
""",
with_data=True
)
I now want to add a unique index to the view and have this managed by alembic, namely:
CREATE unique index vw_period_totals_index ON vw_period_totals (name, period);
I can't add this to the definition argument. So, is there some way to manage this?
antonio-antuan, sstegmueller, elielhaouzi, roberto-stem and rushilsrivastava
Metadata
Metadata
Assignees
Labels
No labels