The bundle Module
Re-point a native Superset dashboard bundle onto a target connection, entirely in memory.
Native bundles bind everything by uuid: charts -> datasets via dataset_uuid,
datasets -> connection via database_uuid, and the dashboard’s position
links charts by meta.uuid. NOTHING is bound by name. Re-pointing is therefore:
every
database_uuid-> the TARGET connection’s uuid (passed in by the caller, who looks it up by name on the live instance),every OTHER uuid -> by default PRESERVED, so a re-import (or an export->import round-trip) UPDATES the same objects and never duplicates them; with
regenerate=Truethey are rewritten to a deterministic uuid5 salted bysalt(the connection name), producing an INDEPENDENT copy that coexists with the preserved-uuid original – use that only for a fork on a second connection, never for the canonical bundle you export/refresh,reconcile each dashboard position
meta.uuidto the regenerated chart uuid,retitle (optional), relocate the datasets/<db>/ folder, tidy vestigial legacy
params, and re-emit a databases/<name>.yaml repointed to the target (matched by uuid on import, so the existing connection is reused, never overwritten – the masked credentials in it are not used).
load() accepts an unpacked bundle dir (containing metadata.yaml, possibly
nested one level) or a .zip. to_zip_bytes() produces an importable bundle.
The on-disk source bundle is never modified.
- repoint(files, *, target_db_uuid, target_db_name, title=None, salt=None, regenerate=False)[source]
Transform an in-memory bundle (from load()) onto the target connection.
By default object uuids are PRESERVED (idempotent: re-import updates the same objects). Pass regenerate=True to rewrite every non-database uuid to a deterministic uuid5 salted by
salt(default: target_db_name), yielding an independent coexisting copy. Returns a new {posix_relpath: text} dict.