Skip to content

Commit

Permalink
[AIRFLOW-6931] Fixed migrations to find all dependencies for MSSQL (#…
Browse files Browse the repository at this point in the history
…9891)

(cherry picked from commit 8a405d2)
  • Loading branch information
BaoshanGu authored and kaxil committed Aug 15, 2020
1 parent 21066c2 commit 9031fbe
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ def get_table_constraints(conn, table_name):
FROM INFORMATION_SCHEMA.TABLE_CONSTRAINTS AS tc
JOIN INFORMATION_SCHEMA.CONSTRAINT_COLUMN_USAGE AS ccu ON ccu.CONSTRAINT_NAME = tc.CONSTRAINT_NAME
WHERE tc.TABLE_NAME = '{table_name}' AND
(tc.CONSTRAINT_TYPE = 'PRIMARY KEY' or tc.CONSTRAINT_TYPE = 'Unique')
(tc.CONSTRAINT_TYPE = 'PRIMARY KEY' or UPPER(tc.CONSTRAINT_TYPE) = 'UNIQUE')
""".format(table_name=table_name)
result = conn.execute(query).fetchall()
constraint_dict = defaultdict(list)
Expand Down

0 comments on commit 9031fbe

Please sign in to comment.