New to Kestra?
Use blueprints to kickstart your first workflows.
Build a Python ELT pipeline with Kestra and dlt. Extract Google Analytics (GA4) data via API and load it into DuckDB for scheduled reporting and analysis.
Build a reproducible ELT pipeline that extracts Google Analytics 4 (GA4) reporting data with dlt (the open source data load tool) and loads it into DuckDB for fast, local SQL analytics. It replaces manual GA4 exports and brittle scripts: it authenticates to the Google Analytics Data API with a service account, runs your dimension and metric queries, and lets dlt infer schemas and create tables automatically, inside a containerized Python step managed by Kestra.
dlt_pipeline task of type io.kestra.plugin.scripts.python.Script runs the whole pipeline.taskRunner (io.kestra.plugin.scripts.runner.docker.Docker) using the python:3.11 container image, so the runtime is isolated and reproducible.beforeCommands install dependencies with pip install dlt[duckdb] and bootstrap the source and destination with dlt --non-interactive init google_analytics duckdb.env variables using dlt naming conventions (for example SOURCES__GOOGLE_ANALYTICS__CREDENTIALS__CLIENT_EMAIL), sourced from Kestra secrets.script defines a QUERIES list (dimensions like browser, city, dateHour and metrics like totalUsers, transactions), builds a dlt.pipeline with destination="duckdb" and dataset_name="google_analytics", then calls pipeline.run(google_analytics(queries=QUERIES)).dlt loads data, but it does not schedule, retry, or observe your runs. Kestra adds declarative YAML pipelines, event and schedule triggers, automatic retries on transient API failures, execution logs, and lineage across runs, without bolting cron and shell glue around the dlt CLI.
GOOGLE_ANALYTICS_PROJECT_IDGOOGLE_ANALYTICS_CLIENT_EMAILGOOGLE_ANALYTICS_PRIVATE_KEYGOOGLE_ANALYTICS_PROPERTY_IDQUERIES list to the dimensions and metrics you want to report on.google_analytics DuckDB dataset.QUERIES to pull additional GA4 reports.Schedule trigger for daily incremental loads.