Skip to content

Commit

Permalink
Use paginated_update
Browse files Browse the repository at this point in the history
  • Loading branch information
kgabryje committed Dec 21, 2023
1 parent e54f29d commit 8586275
Showing 1 changed file with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
from sqlalchemy.ext.declarative import declarative_base

from superset import db
from superset.migrations.shared.utils import paginated_update

# revision identifiers, used by Alembic.
revision = "06dd9ff00fe8"
Expand All @@ -47,7 +48,9 @@ def upgrade():
bind = op.get_bind()
session = db.Session(bind=bind)

for slc in session.query(Slice).filter(Slice.viz_type == "funnel"):
for slc in paginated_update(
session.query(Slice).filter(Slice.viz_type == "funnel")
):
params = json.loads(slc.params)
percent_calculation = params.get("percent_calculation_type")
if not percent_calculation:
Expand All @@ -61,7 +64,9 @@ def downgrade():
bind = op.get_bind()
session = db.Session(bind=bind)

for slc in session.query(Slice).filter(Slice.viz_type == "funnel"):
for slc in paginated_update(
session.query(Slice).filter(Slice.viz_type == "funnel")
):
params = json.loads(slc.params)
percent_calculation = params.get("percent_calculation_type")
if percent_calculation:
Expand Down

0 comments on commit 8586275

Please sign in to comment.