Request icon
OutputValues icon
Download icon
Queries icon
CsvToIon icon
Load icon

Load time series data into InfluxDB

Build a time series pipeline that geocodes a city, pulls hourly weather data, reshapes it with DuckDB, and loads it into InfluxDB with Kestra.

Categories
Data

This blueprint builds an end to end time series ingestion pipeline that turns a plain city name into clean, queryable points inside InfluxDB. It solves a common gap in monitoring and IoT analytics stacks: raw API responses arrive as nested JSON that does not map cleanly to a measurement, and getting that data shaped, typed, and loaded into a time series database usually means glue scripts. Here the whole path from geocoding to load runs as one declarative, reproducible flow.

How it works

  1. The geocoding task (io.kestra.plugin.core.http.Request) calls the Open Meteo geocoding API to resolve the city input into coordinates.
  2. The geo_output task (io.kestra.plugin.core.output.OutputValues) extracts latitude and longitude from the JSON response, falling back to default values if no match is found.
  3. The download_weather_data task (io.kestra.plugin.core.http.Download) fetches hourly temperature_2m readings from the Open Meteo archive API for those coordinates.
  4. The normalize_data task (io.kestra.plugin.jdbc.duckdb.Queries) uses DuckDB to unnest the parallel time and temperature arrays into rows, tag each with the city and coordinates, and write a flat result.csv.
  5. The csv_to_ion task (io.kestra.plugin.serdes.csv.CsvToIon) converts that CSV into Kestra's internal Ion format.
  6. The load task (io.kestra.plugin.influxdb.Load) writes the rows into the temperature_2m measurement in InfluxDB, using the configured org and bucket.

What you get

  • A single flow that goes from a city name to typed time series points in InfluxDB.
  • JSON arrays flattened into proper rows with DuckDB, no custom parsing code.
  • A reusable pattern for ingesting any REST API into a time series store.
  • Clear, inspectable intermediate outputs (CSV and Ion) at every step.

Who it's for

  • Data engineers building time series ingestion pipelines.
  • Platform and observability teams feeding metrics into InfluxDB.
  • IoT and analytics developers normalizing nested API payloads.

Why orchestrate this with Kestra

InfluxDB stores and queries time series, but it does not fetch upstream APIs, reshape nested JSON, or coordinate the steps that produce the data it ingests. Kestra fills that gap. You get event and schedule triggers, automatic retries on transient API or load failures, full execution lineage across every task, and a declarative YAML definition you can version and review. The HTTP, DuckDB, serdes, and InfluxDB steps all live in one auditable flow instead of scattered cron jobs and scripts.

Prerequisites

  • A running InfluxDB instance reachable from Kestra.
  • An InfluxDB organization and bucket (the flow uses test for both).

Secrets

  • INFLUXDB_URL: the base URL of your InfluxDB instance.
  • INFLUXDB_TOKEN: an API token with write access to the target bucket.

Quick start

  1. Add the INFLUXDB_URL and INFLUXDB_TOKEN secrets to your Kestra instance.
  2. Confirm the org and bucket on the load task match your InfluxDB setup.
  3. Add this flow to a namespace and execute it, optionally overriding the city input.
  4. Query the temperature_2m measurement in InfluxDB to verify the loaded points.

How to extend

  • Swap the Open Meteo endpoints for any other REST API and adjust the DuckDB query.
  • Add a Schedule trigger to ingest fresh data on a recurring cadence.
  • Widen the date range or add more hourly fields to capture richer metrics.
  • Add downstream io.kestra.plugin.influxdb query tasks to validate or aggregate after load.

Links

See How

New to Kestra?

Use blueprints to kickstart your first workflows.