You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by GitBox <gi...@apache.org> on 2022/12/22 11:23:44 UTC

[GitHub] [superset] SharonCastel opened a new issue, #22506: Import failed on duplicated key when importing existing chart that its dataset was changed

SharonCastel opened a new issue, #22506:
URL: https://github.com/apache/superset/issues/22506

   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
   1. export dashboard from source env and import it to target env
   2. On the source env:
      1. Go to dashboard
      2. Edit the chart
      3. change its dataset to another
      4. save (overwrite) the chart and the dashboard 
      5. export the dashboard
   3. import the dashboard(2.5) on the target env with overwrite option.
   
   ### 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
   
   - browser type and version: chrome, version 108.0.5359.124
   - superset version: Superset 2.0.0
   - python version: Python 3.8.12
   - any feature flags active:
         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!
   
   - [ V ] I have checked the superset logs for python stacktraces and included it here as text if there are any.
   - [ V ] I have reproduced the issue with at least the latest released version of superset.
   - [ V ] I have checked the issue tracker for the same issue and I haven't found one similar.
   
   ### 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.
   


-- 
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: notifications-unsubscribe@superset.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


[GitHub] [superset] SharonCastel commented on issue #22506: Import failed on duplicated key when importing existing chart that its dataset was changed

Posted by "SharonCastel (via GitHub)" <gi...@apache.org>.
SharonCastel commented on issue #22506:
URL: https://github.com/apache/superset/issues/22506#issuecomment-1416783823

   Yes you right, it can query by the uuid only I believe. Do you know if it fixed on version 2.0.2?


-- 
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: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


[GitHub] [superset] ShaliniIruvuru commented on issue #22506: Import failed on duplicated key when importing existing chart that its dataset was changed

Posted by "ShaliniIruvuru (via GitHub)" <gi...@apache.org>.
ShaliniIruvuru commented on issue #22506:
URL: https://github.com/apache/superset/issues/22506#issuecomment-1582486387

   Yes @SharonCastel  I used for importing changed dataset file.
   
   Can you please provide detail information along with steps.It is more helpful if you provide video.


-- 
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: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


[GitHub] [superset] SharonCastel commented on issue #22506: Import failed on duplicated key when importing existing chart that its dataset was changed

Posted by "SharonCastel (via GitHub)" <gi...@apache.org>.
SharonCastel commented on issue #22506:
URL: https://github.com/apache/superset/issues/22506#issuecomment-1582342606

   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..


-- 
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: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


[GitHub] [superset] SharonCastel commented on issue #22506: Import failed on duplicated key when importing existing chart that its dataset was changed

Posted by "SharonCastel (via GitHub)" <gi...@apache.org>.
SharonCastel commented on issue #22506:
URL: https://github.com/apache/superset/issues/22506#issuecomment-1656641146

   > Export the dashboard(Cho
   
   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.


-- 
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: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


[GitHub] [superset] SharonCastel commented on issue #22506: Import failed on duplicated key when importing existing chart that its dataset was changed

Posted by "SharonCastel (via GitHub)" <gi...@apache.org>.
SharonCastel commented on issue #22506:
URL: https://github.com/apache/superset/issues/22506#issuecomment-1528994330

   Hi All,
   I checked it again with owners on the new version 2.1.0 and unfortunately the issue persists :( when the dataset on the import file is different than the one on the target chart the import of the dashboard failed from unknown reason:
   ![image](https://user-images.githubusercontent.com/93184294/235349055-beff739a-8b4a-430a-878b-eb7af1c71fb9.png)
   This is critical feature in order to have life cycle for superset dashboards.


-- 
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: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


[GitHub] [superset] ShaliniIruvuru commented on issue #22506: Import failed on duplicated key when importing existing chart that its dataset was changed

Posted by "ShaliniIruvuru (via GitHub)" <gi...@apache.org>.
ShaliniIruvuru commented on issue #22506:
URL: https://github.com/apache/superset/issues/22506#issuecomment-1584250941

   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
   1.Export the dashboard(Chosen Sales Dashboard.Here selected one chart having cleaned sales data).
   ![image](https://github.com/apache/superset/assets/115684419/50f41828-a6bd-4ad5-a8f1-05959de88eb7)
   2.Go to sales dashboard.
   
   3.Edit the chart for Total revenue
   
   [4.Do](http://4.do/) Swap dataset (Here change the dataset to Birth names)
   ![image](https://github.com/apache/superset/assets/115684419/29b23965-1896-4846-a0f8-bb6d3bf84ec1)
   5.Save (Overwrite) the chart and Dashboard.
   
   6.Import the dashboard 
   ![image](https://github.com/apache/superset/assets/115684419/63a60f72-85de-4e6e-9ce2-c55d114eefb1)
   
   


-- 
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: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


[GitHub] [superset] jfrag1 commented on issue #22506: Import failed on duplicated key when importing existing chart that its dataset was changed

Posted by "jfrag1 (via GitHub)" <gi...@apache.org>.
jfrag1 commented on issue #22506:
URL: https://github.com/apache/superset/issues/22506#issuecomment-1658890145

   https://github.com/apache/superset/pull/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.


-- 
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: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


[GitHub] [superset] danikv commented on issue #22506: Import failed on duplicated key when importing existing chart that its dataset was changed

Posted by "danikv (via GitHub)" <gi...@apache.org>.
danikv commented on issue #22506:
URL: https://github.com/apache/superset/issues/22506#issuecomment-1632215625

   any updates on that issue ? I can confirm that it's still happening in the main branch.


-- 
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: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


[GitHub] [superset] ShaliniIruvuru commented on issue #22506: Import failed on duplicated key when importing existing chart that its dataset was changed

Posted by "ShaliniIruvuru (via GitHub)" <gi...@apache.org>.
ShaliniIruvuru commented on issue #22506:
URL: https://github.com/apache/superset/issues/22506#issuecomment-1531030444

   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:-
   https://www.loom.com/share/2e9f5d32fae44af592f0c0924b5905c5


-- 
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: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


[GitHub] [superset] SharonCastel commented on issue #22506: Import failed on duplicated key when importing existing chart that its dataset was changed

Posted by "SharonCastel (via GitHub)" <gi...@apache.org>.
SharonCastel commented on issue #22506:
URL: https://github.com/apache/superset/issues/22506#issuecomment-1582579005

   How to reproduce the bug
   export the dashboard - save it to the last step
   Go to dashboard
   Edit the chart
   change its dataset to another - swap dataset
   save (overwrite) the chart and the dashboard
   import the file from the first step with overwrite option.


-- 
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: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


[GitHub] [superset] SharonCastel commented on issue #22506: Import failed on duplicated key when importing existing chart that its dataset was changed

Posted by "SharonCastel (via GitHub)" <gi...@apache.org>.
SharonCastel commented on issue #22506:
URL: https://github.com/apache/superset/issues/22506#issuecomment-1582131305

   Hi @ShaliniIruvuru,
   The edit is working well, but the problem is when you change the data source to another.


-- 
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: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


[GitHub] [superset] ShaliniIruvuru commented on issue #22506: Import failed on duplicated key when importing existing chart that its dataset was changed

Posted by "ShaliniIruvuru (via GitHub)" <gi...@apache.org>.
ShaliniIruvuru commented on issue #22506:
URL: https://github.com/apache/superset/issues/22506#issuecomment-1582298735

   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. 
   Loom video:-
   https://www.loom.com/share/3c0d421d3dd5419e8ed437f6aeb107e6
   
   
   


-- 
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: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [I] Import failed on duplicated key when importing existing chart that its dataset was changed [superset]

Posted by "jfrag1 (via GitHub)" <gi...@apache.org>.
jfrag1 closed issue #22506: Import failed on duplicated key when importing existing chart that its dataset was changed
URL: https://github.com/apache/superset/issues/22506


-- 
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: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


[GitHub] [superset] Zhichi57 commented on issue #22506: Import failed on duplicated key when importing existing chart that its dataset was changed

Posted by "Zhichi57 (via GitHub)" <gi...@apache.org>.
Zhichi57 commented on issue #22506:
URL: https://github.com/apache/superset/issues/22506#issuecomment-1415881060

   The problem is a query to the database that determines the existence of the chart.
   It contains the condition 
   `WHERE slices.datasource_id = %(datasource_id_1)s AND slices.uuid = %(uuid_1)s`
   Because of this, the existence of the diagram is determined incorrectly and is not overwritten.
   The query execute in a file
   https://github.com/apache/superset/blob/master/superset/models/helpers.py#L300
   
   


-- 
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: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [I] Import failed on duplicated key when importing existing chart that its dataset was changed [superset]

Posted by "SharonCastel (via GitHub)" <gi...@apache.org>.
SharonCastel commented on issue #22506:
URL: https://github.com/apache/superset/issues/22506#issuecomment-1876520472

   @jfrag1 you are the best!!! thank you so much for the fix!


-- 
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: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


[GitHub] [superset] adimyth commented on issue #22506: Import failed on duplicated key when importing existing chart that its dataset was changed

Posted by GitBox <gi...@apache.org>.
adimyth commented on issue #22506:
URL: https://github.com/apache/superset/issues/22506#issuecomment-1370870179

   Were you able to find a solution to this?


-- 
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: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


[GitHub] [superset] ShaliniIruvuru commented on issue #22506: Import failed on duplicated key when importing existing chart that its dataset was changed

Posted by "ShaliniIruvuru (via GitHub)" <gi...@apache.org>.
ShaliniIruvuru commented on issue #22506:
URL: https://github.com/apache/superset/issues/22506#issuecomment-1475658975

   It is working fine with owners permission. If Dashboard dont have Owners(None) then it is asking for create new chart. other wise it is working fine.
   Screenshots:-
   ![image](https://user-images.githubusercontent.com/115684419/226257322-842882e3-9d8d-4039-93f9-01946fcb86ec.png)
   ![image](https://user-images.githubusercontent.com/115684419/226257371-6bbfbf55-1839-428b-a3ae-6fadbceea57f.png)
   
   
   


-- 
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: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org