16 lines
540 B
Python
16 lines
540 B
Python
|
|
app = __import__("superset.app", fromlist=["create_app"]).create_app()
|
||
|
|
|
||
|
|
with app.app_context():
|
||
|
|
from superset.extensions import db
|
||
|
|
from superset.models.slice import Slice
|
||
|
|
charts = db.session.query(Slice).all()
|
||
|
|
for sl in charts:
|
||
|
|
try:
|
||
|
|
sl.query_context = sl.get_query_context()
|
||
|
|
db.session.add(sl)
|
||
|
|
print("saved", sl.id, (sl.slice_name or "")[:50])
|
||
|
|
except Exception as e:
|
||
|
|
print("err", sl.id, e)
|
||
|
|
db.session.commit()
|
||
|
|
print("committed", len(charts), "charts")
|