Skip to content

Commit

Permalink
Add table alias to SQLTableCheckOperator query
Browse files Browse the repository at this point in the history
Without a table alias, the query does not run on Postgres and
other databases. The alias is arbitrary and used only for
proper query execution.
  • Loading branch information
denimalpaca committed Jul 21, 2022
1 parent d364e96 commit 3c300e7
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion airflow/providers/common/sql/operators/sql.py
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ class SQLTableCheckOperator(BaseSQLOperator):

sql_check_template = """
SELECT '_check_name' AS check_name, MIN(_check_name) AS check_result
FROM(SELECT CASE WHEN check_statement THEN 1 ELSE 0 END AS _check_name FROM table)
FROM(SELECT CASE WHEN check_statement THEN 1 ELSE 0 END AS _check_name FROM table) AS check_table
"""

def __init__(
Expand Down

0 comments on commit 3c300e7

Please sign in to comment.