BranchSQLOperator
Common SQLAllows a DAG to “branch” or follow a specified path based on the results of a SQL query.
Access Instructions
Install the Common SQL provider package into your Airflow environment.
Import the module into your DAG file and instantiate it with your desired params.
Parameters
sqlRequiredThe SQL code to be executed, should return true or false (templated) Template reference are recognized by str ending in ‘.sql’. Expected SQL query to return Boolean (True/False), integer (0 = False, Otherwise = 1) or string (true/y/yes/1/on/false/n/no/0/off).
follow_task_ids_if_trueRequiredtask id or task ids to follow if query returns true
follow_task_ids_if_falseRequiredtask id or task ids to follow if query returns false
conn_idthe connection ID used to connect to the database.
databasename of database which overwrite the defined one in connection
parameters(optional) the parameters to render the SQL query with.
Documentation
Allows a DAG to “branch” or follow a specified path based on the results of a SQL query.