BranchSQLOperator

Apache Airflow Certified

Executes sql code in a specific database

View Source

Last Updated: Apr. 2, 2021

Access Instructions

Install the Apache Airflow provider package into your Airflow environment.

Import the module into your DAG file and instantiate it with your desired params.

Parameters

sqlCan receive a str representing a sql statement or reference to a template file. 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).the sql code to be executed. (templated)
follow_task_ids_if_truestr or listtask id or task ids to follow if query return true
follow_task_ids_if_falsestr or listtask id or task ids to follow if query return true
conn_idstrreference to a specific database
databasename of database which overwrite defined one in connection
parametersmapping or iterable(optional) the parameters to render the SQL query with.

Documentation

Executes sql code in a specific database

Example DAGs

Improve this module by creating an example DAG.

View Source
  1. Add an `example_dags` directory to the top-level source of the provider package with an empty `__init__.py` file.
  2. Add your DAG to this directory. Be sure to include a well-written and descriptive docstring
  3. Create a pull request against the source code. Once the package gets released, your DAG will show up on the Registry.

Was this page helpful?