dosubot[bot] commented on issue #36021:
URL: https://github.com/apache/superset/issues/36021#issuecomment-3497303105

   <!-- Greeting -->
   Hi @david-heward-unmind! I'm [Dosu](https://go.dosu.dev/dosubot) and I’m 
helping the superset team.
   
   <!-- Answer -->
   This workflow isn’t supported in Superset. The import process uses the 
dataset’s UUID as the primary identifier—so if you export a dataset, change 
only its `database_uuid` in the YAML, and re-import, Superset will try to 
update the existing dataset (if `overwrite=true`) or skip it (if 
`overwrite=false`). If the dataset UUID already exists, but the database 
association doesn’t match, you’ll hit unique constraint violations like the one 
you’re seeing, because the UUID is already present in the metadata DB and 
Superset expects the (database, table) combination to be unique 
[[source]](https://github.com/apache/superset/discussions/34573).
   
   To migrate datasets to a new database with the same schema and fresh data, 
you need to generate new UUIDs for all assets (database, datasets, charts, 
dashboards) and update all references in the YAML files before import. This is 
the only way to create new, independent resources for the new database without 
conflicting with existing ones. There’s no built-in flag or shortcut for 
this—teams usually script the UUID and reference replacement as part of their 
onboarding or migration automation 
[[source]](https://github.com/apache/superset/discussions/34573).
   
   Fields like `id`, `slice_id`, and `chartId` should be omitted from your 
YAMLs; Superset manages those internally and uses UUIDs for linking assets 
during import. The import process will update all references in chart params 
and dashboard layouts automatically 
[[source]](https://github.com/apache/superset/discussions/34573).
   
   In short: changing only the `database_uuid` is not enough and will always 
cause conflicts. You must generate new UUIDs for all assets and update all 
references to migrate datasets to a new database cleanly.
   
   
   <!-- Dosu Comment Footer -->
   *To reply, just mention [@dosu](https://go.dosu.dev/dosubot).*
   
   ---
   <sup>How did I do? 
[Good](https://app.dosu.dev/response-feedback/9be1c697-b8f1-4229-8611-939d405d6ae8?feedback_type=great_response)
 | 
[Irrelevant](https://app.dosu.dev/response-feedback/9be1c697-b8f1-4229-8611-939d405d6ae8?feedback_type=irrelevant_answer)
 | 
[Incorrect](https://app.dosu.dev/response-feedback/9be1c697-b8f1-4229-8611-939d405d6ae8?feedback_type=incorrect_sources)
 | 
[Verbose](https://app.dosu.dev/response-feedback/9be1c697-b8f1-4229-8611-939d405d6ae8?feedback_type=too_verbose)
 | 
[Hallucination](https://app.dosu.dev/response-feedback/9be1c697-b8f1-4229-8611-939d405d6ae8?feedback_type=hallucination)
 | [Report 
🐛](https://app.dosu.dev/response-feedback/9be1c697-b8f1-4229-8611-939d405d6ae8?feedback_type=bug_report)
 | 
[Other](https://app.dosu.dev/response-feedback/9be1c697-b8f1-4229-8611-939d405d6ae8?feedback_type=other)</sup>&nbsp;&nbsp;[![Chat
 with 
Dosu](https://dosu.dev/dosu-chat-badge.svg)](https://app.dosu.dev/a28d3c7e-a9d3-459e-9fb6-3a6f9ff4f357/ask?utm_source=githu
 b)&nbsp;[![Join 
Discord](https://img.shields.io/badge/join-5865F2?logo=discord&logoColor=white&label=)](https://go.dosu.dev/discord-bot)&nbsp;[![Share
 on 
X](https://img.shields.io/badge/X-share-black)](https://twitter.com/intent/tweet?text=%40dosu_ai%20helped%20me%20solve%20this%20issue!&url=https%3A//github.com/apache/superset/issues/36021)


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to