-
Notifications
You must be signed in to change notification settings - Fork 13.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Import failed on duplicated key when importing existing chart that its dataset was changed #22506
Comments
Were you able to find a solution to this? |
The problem is a query to the database that determines the existence of the chart. |
Yes you right, it can query by the uuid only I believe. Do you know if it fixed on version 2.0.2? |
Hi SharonCastel, I have also checked it again with owners on the new version 2.1.0 .I didn’t get any error,it’s working fine. Loom video:- |
Hi @ShaliniIruvuru, |
Hi @SharonCastel ,Checked in swap dataset also.I didn't get any error.Just i followed which you added that steps in how to reproduce the bug. |
I watched the video but didnt understand which file did you import.. unfortunately if its the same file as you just exported so it wont reproduce the issue.. |
Yes @SharonCastel I used for importing changed dataset file. Can you please provide detailed information along with steps.It is more helpful if you provide video. |
How to reproduce the bug |
Hi @SharonCastel ,I am not getting any error.I followed what ever you provided the steps and also providing the steps which I followed...Can you please go through 3.Edit the chart for Total revenue 4.Do Swap dataset (Here change the dataset to Birth names) |
any updates on that issue ? I can confirm that it's still happening on the main branch. |
I believe you imported it on the same environment so the local id is the same and the issue wont bug you, but if you export one and import it to another environment it fails with duplicate error on the id which is the sequence of the db different on each env. |
#24821 was merged which should resolve this issue; it's currently tagged for the 2.1.2 and 3.0 releases, so it should be included in both of those. |
@jfrag1 you are the best!!! thank you so much for the fix! |
Every time we import a dashboard with chart that its dataset was changed, we're Getting the error:
psycopg2.errors.UniqueViolation: duplicate key value violates unique constraint "uq_slices_uuid"
How to reproduce the bug
Expected results
The import will overwrite the existing chart on the target env and update it to the new dataset (which by the way exists already on the target env)
Actual results
The import failed with the error:
psycopg2.errors.UniqueViolation: duplicate key value violates unique constraint "uq_slices_uuid"
Screenshots
Traceback (most recent call last): File "/app/superset/cli/importexport.py", line 163, in import_dashboards ImportDashboardsCommand(contents, overwrite=True).run() File "/app/superset/dashboards/commands/importers/dispatcher.py", line 68, in run raise exc File "/app/superset/dashboards/commands/importers/dispatcher.py", line 57, in run command.run() File "/app/superset/commands/importers/v1/__init__.py", line 72, in run raise self.import_error() from ex superset.dashboards.commands.exceptions.DashboardImportError: Import dashboard failed for an unknown reason 2022-12-22 10:57:29,174:ERROR:superset.cli.importexport:There was an error when importing the dashboards(s), please check the exception traceback in the log Traceback (most recent call last): File "/usr/local/lib/python3.8/site-packages/sqlalchemy/engine/base.py", line 1276, in _execute_context self.dialect.do_execute( File "/usr/local/lib/python3.8/site-packages/sqlalchemy/engine/default.py", line 608, in do_execute cursor.execute(statement, parameters) psycopg2.errors.UniqueViolation: duplicate key value violates unique constraint "uq_slices_uuid" DETAIL: Key (uuid)=(8eab9982-aaaa-450c-bbbb-1761d8c207f6) already exists.
Environment
FEATURE_FLAGS = {
"DYNAMIC_PLUGINS": True,
"ENABLE_TEMPLATE_PROCESSING": True,
"VERSIONED_EXPORT": True,
"DASHBOARD_RBAC": True,
"DASHBOARD_CROSS_FILTERS": True
}
Checklist
Make sure to follow these steps before submitting your issue - thank you!
Additional context
When I delete the chart from the target env and reimport it succeeded (unless there is another chart with the same change)
In the code I see there is a select from tables before the insert into slices which probably makes that issue.
The text was updated successfully, but these errors were encountered: