Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[hotfix] resolve utf-8 encoding issue in db migration #4461

Merged
merged 6 commits into from
Feb 22, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions superset/migrations/versions/e866bd2d4976_smaller_grid.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ def upgrade():

dashboards = session.query(Dashboard).all()
for i, dashboard in enumerate(dashboards):
print('Upgrading ({}/{}): {}'.format(
i, len(dashboards), dashboard.id))
positions = json.loads(dashboard.position_json or '{}')
for pos in positions:
if pos.get('v', 0) == 0:
Expand All @@ -44,8 +46,6 @@ def upgrade():
dashboard.position_json = json.dumps(positions, indent=2)
session.merge(dashboard)
session.commit()
print('Upgraded ({}/{}): {}'.format(
i, len(dashboards), dashboard.dashboard_title))

session.close()

Expand All @@ -56,6 +56,8 @@ def downgrade():

dashboards = session.query(Dashboard).all()
for i, dashboard in enumerate(dashboards):
print('Downgrading ({}/{}): {}'.format(
i, len(dashboards), dashboard.id))
positions = json.loads(dashboard.position_json or '{}')
for pos in positions:
if pos.get('v', 0) == 1:
Expand All @@ -68,6 +70,4 @@ def downgrade():
dashboard.position_json = json.dumps(positions, indent=2)
session.merge(dashboard)
session.commit()
print('Downgraded ({}/{}): {}'.format(
i, len(dashboards), dashboard.dashboard_title))
pass