Skip to content

Commit

Permalink
do not populate materialized views with data during simulation
Browse files Browse the repository at this point in the history
  • Loading branch information
olirice committed Jul 16, 2021
1 parent 944e3a7 commit 37abb94
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/alembic_utils/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "0.7.0"
__version__ = "0.7.1"
9 changes: 9 additions & 0 deletions src/alembic_utils/simulate.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# pylint: disable=unused-argument,invalid-name,line-too-long
import copy
import logging
from contextlib import ExitStack, contextmanager
from typing import TYPE_CHECKING, List, Optional
Expand All @@ -21,6 +22,14 @@ def simulate_entity(
"""Creates *entiity* in a transaction so postgres rendered definition
can be retrieved
"""

# When simulating materialized view, don't populate them with data
from alembic_utils.pg_materialized_view import PGMaterializedView

if isinstance(entity, PGMaterializedView) and entity.with_data:
entity = copy.deepcopy(entity)
entity.with_data = False

deps: List["ReplaceableEntity"] = dependencies or []

try:
Expand Down

0 comments on commit 37abb94

Please sign in to comment.