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 2021/07/21 00:09:03 UTC

[GitHub] [superset] eschutho commented on a change in pull request #15807: fix: migration script can't drop constraint

eschutho commented on a change in pull request #15807:
URL: https://github.com/apache/superset/pull/15807#discussion_r673571301



##########
File path: superset/migrations/versions/49b5a32daba5_add_report_schedules.py
##########
@@ -119,13 +120,17 @@ def upgrade():
     )
 
 
+def has_unique_constraint(constraint_name: str, table_name: str) -> bool:
+    bind = op.get_bind()
+    inspector = Inspector.from_engine(bind)
+    unique_constraints = inspector.get_unique_constraints(table_name)
+    return constraint_name in {constraint["name"] for constraint in unique_constraints}

Review comment:
       is constraint guaranteed to have a key of "name" for every engine?




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