InfluxDB3Sensor

Use InfluxDB3Sensor to wait until an InfluxDB 3.x SQL query returns a truthy first cell. Prefer an efficient existence query that returns one value and limits the result to one row.

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

wait_for_data = InfluxDB3Sensor(
    task_id="wait_for_data",
    sql="""SELECT 1 FROM "temperature" WHERE time > now() - INTERVAL '1 hour' LIMIT 1""",
    influxdb3_conn_id="influxdb3_default",
    poke_interval=60,
    timeout=3600,
    deferrable=True,
)

An empty result, a missing value, numeric or string zero, and an empty string are treated as false. Set fail_on_empty=True to fail immediately when the query returns no rows.

Deferrable mode

Set deferrable=True to release the worker slot between queries. The InfluxDB3SensorTrigger repeats the query at the configured poke_interval until the condition is met or Airflow reaches the sensor timeout.

Was this entry helpful?