InfluxDBOperator

Use the InfluxDBOperator to execute SQL commands in a InfluxDB database.

An example of running the query using the operator:

tests/system/influxdb/example_influxdb_query.py[source]


    query_influxdb_task = InfluxDBOperator(
        influxdb_conn_id="influxdb_conn_id",
        task_id="query_influxdb",
        sql='from(bucket:"test-influx") |> range(start: -10m, stop: {{ds}})',
        dag=dag,
    )

InfluxDB3Operator

The InfluxDB3Operator executes SQL queries in an InfluxDB 3.x database.

Example usage:

tests/system/influxdb/example_influxdb3.py[source]

query_task = InfluxDB3Operator(
    task_id="query_data",
    sql="SELECT * FROM \"temperature\" WHERE time > now() - INTERVAL '1 hour'",
    influxdb3_conn_id="influxdb3_default",
)

Was this entry helpful?