assets import #34573
Replies: 6 comments 5 replies
|
To import a full set of Superset assets (database, datasources, charts, dashboards) via POST /api/v1/assets/import/, your ZIP bundle must have this structure and content:
Example directory tree: Minimal example for each asset (YAML or JSON is accepted): databases/my_database.yaml database_name: my_db
sqlalchemy_uri: postgresql://user:pass@host/db
uuid: 11111111-1111-1111-1111-111111111111
version: 1.0.0datasets/my_dataset.yaml table_name: my_table
database_uuid: 11111111-1111-1111-1111-111111111111
uuid: 22222222-2222-2222-2222-222222222222
columns: []
metrics: []
version: 1.0.0charts/my_chart.yaml slice_name: my_chart
viz_type: big_number
dataset_uuid: 22222222-2222-2222-2222-222222222222
uuid: 33333333-3333-3333-3333-333333333333
params: {}
version: 1.0.0dashboards/my_dashboard.yaml dashboard_title: my_dashboard
uuid: 44444444-4444-4444-4444-444444444444
position:
CHART-1:
meta:
chartId: 1
uuid: 33333333-3333-3333-3333-333333333333
type: CHART
DASHBOARD_VERSION_KEY: v2
metadata: {}
version: 1.0.0Upload the ZIP as the formData field in a multipart/form-data request, with overwrite as a separate string field ("true" or "false") [source]. Common pitfalls: missing dependencies, incorrect UUIDs, or missing/incorrect metadata.yaml will cause import errors. All referenced assets must be present in the bundle, and UUIDs must match across references [source] [source]. For large bundles (over 100MB), use the CLI import tools instead of the API [source]. Let me know if you need a more detailed example for any specific asset! To reply, just mention @dosu. Docs are dead. Just use Dosu. |
|
@dosu my use case is i have a set having one database connection, 5 datasets from it, 20 charts from these datasets, 6 dashboards from these charts. i have to add all these once for every new tenant registered with only the name of database change in db connection and not disturbing existing resources inside the superset |
|
@dosu what about what about slice_id, id in chart yaml's and id, chartId and id fields in dashboard yamls ? |
|
@dosu what about in a chart yaml datasource: 1__table, slice_id:1, optionName, dashboards of params and '{"datasource":{"id":1,, "dashboards":[1], "form_data":{"datasource":"1__table","viz_type":"echarts_timeseries_line","slice_id":1 of query context |
|
@dosu slice_name: tenant-1_activepower
|
|
@dosu 2025-08-12 06:27:30,467:WARNING:superset.commands.database.utils:Error processing catalog 'None' /app/superset/connectors/sqla/models.py:2078: SAWarning: Usage of the 'related attribute set' operation is not currently supported within the execution stage of the flush process. Results may not be consistent. Consider using alternative event listeners or connection-level operations instead. self.database = session.query(Database).filter_by(id=self.database_id).one() /app/superset/connectors/sqla/models.py:2078: SAWarning: Usage of the 'collection append' operation is not currently supported within the execution stage of the flush process. Results may not be consistent. Consider using alternative event listeners or connection-level operations instead. self.database = session.query(Database).filter_by(id=self.database_id).one() /app/superset/models/helpers.py:323: SAWarning: Attribute history events accumulated on 1 previously clean instances within inner-flush event handlers have been reset, and will not result in database updates. Consider using set_committed_value() within inner-flush event handlers to avoid this warning. obj = obj_query.one_or_none() 2025-08-12 06:27:30,731:WARNING:superset.views.error_handling:CommandException Traceback (most recent call last): File "/app/superset/utils/decorators.py", line 259, in wrapped File "/app/superset/commands/importers/v1/assets.py", line 164, in run File "/app/superset/commands/importers/v1/assets.py", line 125, in _import File "/app/superset/commands/dashboard/importers/v1/utils.py", line 69, in update_id_refs File "/app/superset/commands/dashboard/importers/v1/utils.py", line 49, in build_uuid_to_id_map File "/app/superset/commands/dashboard/importers/v1/utils.py", line 50, in KeyError: 'chartId' |
Uh oh!
There was an error while loading. Please reload this page.
POST {{baseUrl}}/api/v1/assets/import/. @dosu please tell me how the zip file or json of bundle input for the given api call should be in-order to set a database connection, datasources from the declared db connection, charts from the declared datasorces and dashboards with charts from declared charts
All reactions