Build an ETL Pipeline from a REST API Using Python, Polars, and DuckDB
Extract data from a REST API, reshape it with Python and Polars, then run analytical SQL on it with DuckDB, all in one Kestra flow.
Search YouTube transcripts with Arcmira and export timestamped excerpts and source links to a CSV for research and video planning.
Search indexed YouTube transcripts for one research topic and export the returned passages to a source sheet. Keep the exact query and API response beside the CSV so reviewers can inspect each source and the search's coverage notes.
build_query validates the topic, UTC date window and result limit, then URL-encodes
them into one search request. User text is passed through environment variables.search sends one authenticated GET request to Arcmira's /v1/search endpoint.
HTTP errors fail the flow; there are no retries or fallback sources.has_matches exports returned passages through source_sheet, or preserves the
empty response through no_matches. The flow does not paginate, download media
or generate transcripts.outputs.source_sheet.outputFiles['source-sheet.csv'] contains video_id,
published_at, start_seconds, watch_url and text. Leading spreadsheet
formula characters in text cells are escaped with an apostrophe.outputs.source_sheet.outputFiles['response.json'] preserves the unchanged API
response, including partial-result, index-health and access notes.outputs.source_sheet.outputFiles['request.json'] records the exact query and window.outputs.no_matches.uri contains the response instead of a CSV.
An empty result does not establish that a topic was never discussed.Kestra keeps the schedule, secret-backed request, export and execution history in one flow. Each run retains its query and response, so a reviewer can trace a CSV row back to the search that produced it. Other tasks can consume the output files for storage or reporting without embedding an API key in a script.
python:3.13.15-slim. The scripts use only the Python standard library.https://api.arcmira.com.ARCMIRA_API_KEY: supplies the Bearer token for the authenticated search request.
Store it in Kestra's configured secrets mechanism and read it with
{{ secret('ARCMIRA_API_KEY') }}. Do not paste a key into the flow or its inputs.query, a string of at least two characters. It defaults to
creator economy.published_after and published_before as UTC dates, with the start
before the end. The start is inclusive and the end is exclusive. Omitted dates use
a rolling window from 60 to 31 days before execution, outside the Free plan's
freshness gate. To reproduce the documented example, use 2026-08-01 and 2026-09-01.limit is an integer, defaults to 3 and accepts 1 to 20. The first five search
passages per request are free; results after those use credits. A paid read uses
credits from your plan, then your enabled on-demand budget.
Account limits still apply.watch_url alongside the preserved response.
Results are research leads; check context, attribution and reuse rights before
quoting a passage or editing a recording. The flow supplies no video rights.Coverage depends on the index and the account's plan. The flow does not change plans or bypass access gates. Inspect partial-result and access notes before drawing conclusions.
source_sheet to archive the CSV, request and response
together under the execution ID.video_id and start_seconds
because the rolling date windows overlap.