Version v0.4.0 of the documentation is no longer actively maintained. The site that you are currently viewing is an archived snapshot. For up-to-date documentation, see the latest version.

InfluxDB connection

InfluxDB connection

Connect a task to an InfluxDB time-series database (the InfluxDBHook) over a managed Leoflow Connection. InfluxDB 2.x authenticates with an org + token carried in Extra — not login/password.

Declare the provider

# leoflow.yaml
dag_id: influxdb_smoke
connectors:
  - influxdb

URI shape

influxdb://<host>:<port>?__extra__=<json>

The control plane builds this URI from the Connection’s fields. The __extra__ query parameter carries the org and token JSON, percent-escaped; InfluxDBHook recovers it. The token round-trip through __extra__ is pinned by TestInfluxdbConnectionURIShapeIntegration (in internal/storage/).

Connection fieldsURI
host=warehouse.example.com port=8086 extra={"org":"acme","token":"…"}influxdb://warehouse.example.com:8086?__extra__=%7B…%7D

Fields the UI asks for

FieldRequiredNotes
Conn Idyese.g. influxdb_target. Exported as AIRFLOW_CONN_INFLUXDB_TARGET (uppercased).
Conn Typeyesinfluxdb.
HostyesDNS name or IP of the InfluxDB endpoint.
PortoptionalDefaults to 8086.
SchemanoLeave blank — InfluxDB 2.x uses bucket/org, not a DB schema.
LoginnoNot used by token auth.
PasswordnoNot used by token auth.
ExtrayesJSON with org and token, e.g. {"org":"acme","token":"<token>"}. Encrypted at rest (ADR 0019).

Example DAG

The provider import must live inside the task body — a top-level provider import fails compilation in the parser sidecar.

# dag.py
from airflow.sdk import DAG, task


@task
def query():
    from airflow.providers.influxdb.hooks.influxdb import InfluxDBHook

    hook = InfluxDBHook(conn_id="influxdb_target")
    client = hook.get_conn()
    print("influxdb up:", client.ping())


with DAG("influxdb_smoke", schedule=None, catchup=False, tags=["example"]):
    query()
# leoflow.yaml
schema_version: "1.0"
dag_id: influxdb_smoke
python_version: "3.11"
connectors:
  - influxdb

Security notes

  • Token in Extra: the API token is the credential. It is encrypted at rest (ADR 0019) and delivered only over an authenticated gRPC channel.
  • Secrets in logs: never print() the URI — its __extra__ carries the token. Log host + port only.
  • gRPC channel (agent ↔ control plane): Connections are only served over an authenticated channel (see #58 + ADR 0021).
  • ADR 0019 — secret encryption at rest.
  • ADR 0021 — agent secret delivery (AIRFLOW_CONN_<CONN_ID>).
  • #142 — connector cookbook umbrella.