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 17:01:58 UTC

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

john-bodley commented on a change in pull request #15807:
URL: https://github.com/apache/superset/pull/15807#discussion_r674172137



##########
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:
       @betodealmeida it seems like we have similar logic like this [elsewhere](https://github.com/apache/superset/blob/62a8f2e193da3bdf1f43be085b5814be3dd476fa/superset/utils/core.py#L675-L684).




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