uranusjr commented on code in PR #51336:
URL: https://github.com/apache/airflow/pull/51336#discussion_r2122536230


##########
airflow-core/src/airflow/migrations/utils.py:
##########
@@ -103,3 +103,20 @@ def mysql_drop_index_if_exists(index_name, table_name, op):
             SELECT 1;
         END IF;
     """)
+
+
+def _sqlite_guarded_drop_constraint(
+    *,
+    table: str,
+    key: str,
+    type_: str,
+    op,
+) -> None:
+    conn = op.get_bind()
+    dialect_name = conn.dialect.name
+    try:
+        with op.batch_alter_table(table, schema=None) as batch_op:
+            batch_op.drop_constraint(key, type_=type_)
+    except ValueError:
+        if dialect_name != "sqlite":
+            raise

Review Comment:
   That’s unfortunate, I wish sqlite raises a more specific exception type 
instead.



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to