john-bodley commented on code in PR #22413:
URL: https://github.com/apache/superset/pull/22413#discussion_r1071634039


##########
tests/integration_tests/charts/api_tests.py:
##########
@@ -1315,9 +1315,10 @@ def test_import_chart(self):
 
         chart.owners = []
         dataset.owners = []
-        database.owners = []
         db.session.delete(chart)
+        db.session.commit()

Review Comment:
   I was running into a similar issue to 
[this](https://stackoverflow.com/questions/17198595/sqlalchemy-delete-error-caused-by-having-a-both-lazy-load-and-a-dynamic-version)
 which only happens when I set the `lazy="selectin"` relationship property 
which—somewhat peculiarly—only ensures eager loading for the bidirectional 
relationships when the reciprocal is `lazy="joined"`, i.e., if `lazy="select"`, 
SQLAlchemy performs `N` queries for when selecting the 
`TableColumn.table`/`SqlMetric.table` field.
   
   The TL;DR is I've tried a slew of things and the only success—per the Stack 
Overflow post—was to commit between deleting the dataset and chart. Note this 
doesn't seem to be an issue in production (per my manual tests) given that one 
doesn't delete both a dataset/database at the same time. 



##########
tests/integration_tests/charts/api_tests.py:
##########
@@ -1315,9 +1315,10 @@ def test_import_chart(self):
 
         chart.owners = []
         dataset.owners = []
-        database.owners = []

Review Comment:
   Databases don't have owners.



-- 
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-unsubscr...@superset.apache.org

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


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

Reply via email to