Repository navigation
import dashboard #41337
Replies: 2 comments
|
This issue occurs because when dashboards are imported from a ZIP/YAML export, the dataset metadata (physical database column types, calculated metrics, and temporal flags) is imported from the export schema, but the underlying database connection in the target environment has not yet synchronized column types with the target database engine. When you click "Edit Dataset" and then "Save", Superset triggers How to synchronize all datasets in bulkYou do not need to edit them manually one by one. You can automate this using either the Superset CLI or a short Python administrative script. Method 1: Administrative CLI CommandExecute the # In Docker Compose
docker compose exec superset superset refresh-datasources
# Or targeting a specific database connection
docker compose exec superset superset refresh-datasources --database-name "YourDatabase"Method 2: Python Script (Bulk Refresh via Superset App Context)Run this script inside the Superset container using from superset.app import create_app
app = create_app()
with app.app_context():
from superset import db
from superset.connectors.sqla.models import SqlaTable
datasets = db.session.query(SqlaTable).all()
print(f"Syncing metadata for {len(datasets)} datasets...")
for ds in datasets:
try:
ds.fetch_metadata()
print(f"Successfully refreshed: {ds.table_name} (ID: {ds.id})")
except Exception as e:
print(f"Error refreshing {ds.table_name}: {e}")
db.session.commit()
print("Bulk metadata sync complete.")Method 3: REST API Refresh LoopIf you prefer using the REST API from CI/CD, call the refresh endpoint for each dataset ID: # Obtain your JWT token via /api/v1/security/login, then:
curl -X POST "http://localhost:8088/api/v1/dataset/<DATASET_ID>/refresh" \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json"Running either Method 1 or 2 will synchronize all columns and metrics across all imported datasets at once. |
|
A quick precision regarding the REST API endpoint: |
Uh oh!
There was an error while loading. Please reload this page.
Hi, I ran into a problem when importing dashboards, the charts are not displayed until you click save to edit dataset.

And you don't need to edit anything, just click the "save" button

How to do it massively when there are a lot of datasets
All reactions