Load AWX data to DuckDB
Build a AWX to DuckDB pipeline with your coding agent. One prompt scaffolds it with the dltHub AI harness, plus the AWX API base URL, auth, endpoints, and incremental loading.
AWX is a web-based management interface for Ansible that provides a REST API to manage resources such as jobs, inventories, and credentials. Everything needed to build a working AWX → DuckDB pipeline is on this page: the API's base URL, authentication, endpoints, pagination and incremental field — plus a prompt that hands the whole job to your coding agent.
Build your AWX to DuckDB pipeline
Paste this prompt into Claude, Codex, or Cursor. The agent does the rest.
PromptRunuvx dlthub-init@latestto build a pipeline from AWX to DuckDB and run it on dltHub
That scaffolds a dltHub workspace and installs the dltHub AI harness — the project rules, the secrets-management skill, and the dlt MCP server your agent needs to work safely. From there it reads the AWX API, proposes the endpoints to load, then writes, runs and validates the pipeline while you review rather than type. Credentials are inspected through MCP tools, so your agent never reads secrets.toml itself. How the LLM-native workflow works →
Prefer to write it yourself? Every fact the agent uses is below.
AWX API at a glance
| Base URL | https://your-awx-host/api/v2/ |
| Example endpoint | GET api/v2/inventories/ |
| Records found at | results |
| Authentication | All requests require a Bearer token in the Authorization header — sent in the Authorization header, prefixed Bearer |
| Pagination | Page-number via page, next cursor at none, page size via page_size (max 200). AWX list endpoints are paginated using page-number pagination. Use the query parameter page= for the page index and page_size= to control results per request. The response includes a 'next' URL; requesting that URL will automatically carry the correct page/page_size query parameters. The 'next' and 'previous' fields are links, not a separate cursor token. |
| Incremental field | modified |
| Record id | id |
| API reference | https://docs.ansible.com/projects/awx/en/latest/rest_api/authentication.html |
These values come from the AWX API reference — the authoritative source if anything here looks out of date.
How do I authenticate with the AWX API?
AWX uses OAuth 2.0 Bearer tokens for programmatic authentication, supplied in the 'Authorization' header as 'Bearer '.
1. Get your credentials
To obtain credentials for the AWX REST API, it is recommended to use OAuth 2 Personal Access Tokens (PATs). Follow these steps: 1. Log into your AWX Web UI. 2. Navigate to your user profile (click your username in the top right, then 'User Details'). 3. Click on the 'Tokens' tab. 4. Click the 'Add' (or 'Create Token') button. 5. Provide a description and select the desired scope ('Read' or 'Write'). 6. Save the token; note that it will be displayed only once. You can also generate tokens programmatically by sending a POST request to /api/v2/users/<user_id>/personal_tokens/ using Basic Authentication credentials.
2. Add them to .dlt/secrets.toml
[sources.awx_source] awx_api_token = "your_personal_access_token_here" awx_host = "https://your-awx-host.com"
dlt reads this file automatically at runtime. With the harness, the setup-secrets skill prompts you for the values and never handles the raw credential in chat. For production, see setting up credentials with dlt.
What AWX data can I load into DuckDB?
These are the AWX endpoints dlt can load into DuckDB:
| Resource | Endpoint | Method | Data selector | Description |
|---|---|---|---|---|
| jobs | /api/v2/jobs/ | GET | results | List all jobs |
| inventories | /api/v2/inventories/ | GET | results | List all inventories |
| job_templates | /api/v2/job_templates/ | GET | results | List all job templates |
| projects | /api/v2/projects/ | GET | results | List all projects |
| organizations | /api/v2/organizations/ | GET | results | List all organizations |
How do I load only new AWX records?
AWX exposes modified on api/v2/inventories/, so dlt can request only the records that changed since the last run. Set it as the cursor_path and dlt tracks the high-water mark for you between runs.
{"name": "inventories", "endpoint": { "path": "api/v2/inventories/", "data_selector": "results", "incremental": {"cursor_path": "modified", "initial_value": "2024-01-01T00:00:00Z"}, }}
On the first run dlt loads everything from initial_value; on every run after that it requests only what changed and appends with write_disposition="merge" if you set a primary key. See incremental loading.
What does the generated AWX pipeline look like?
A standard dlt REST API pipeline — the same code you would write by hand, loading /api/v2/job_templates/ and /api/v2/jobs/ from the AWX API into DuckDB:
import dlt from dlt.sources.rest_api import RESTAPIConfig, rest_api_resources @dlt.source def awx_source(token=dlt.secrets.value): config: RESTAPIConfig = { "client": { "base_url": "https://your-awx-host/api/v2/", "auth": {"type": "bearer", "token": token}, }, "resources": [ {"name": "inventories", "endpoint": {"path": "api/v2/inventories/", "data_selector": "results"}}, {"name": "jobs", "endpoint": {"path": "api/v2/jobs/", "data_selector": "results"}} ], } yield from rest_api_resources(config) def load_awx_to_duckdb() -> None: pipeline = dlt.pipeline( pipeline_name="awx_pipeline", destination="duckdb", dataset_name="awx_data", ) load_info = pipeline.run(awx_source()) print(load_info) if __name__ == "__main__": load_awx_to_duckdb()
Run it with python awx_pipeline.py. The agent iterates on this until it loads cleanly — you review and approve, rather than write it from scratch.
How do I query AWX data in DuckDB?
dlt creates one table per resource. Query the loaded data with Python or SQL — or ask your agent to, through the MCP server's execute_sql_query tool.
Python (pandas DataFrame):
import dlt data = dlt.pipeline("awx_pipeline").dataset() df = data.inventories.df() print(df.head())
SQL:
SELECT * FROM awx_data.inventories LIMIT 10;
See querying your data with dataset and exploring it in marimo notebooks.
How do I deploy the AWX to DuckDB pipeline in production?
The pipeline runs locally, which is ideal for prototyping and one-off analysis. When you need it on a schedule, monitored on every load, and shared with your team, deploy the same dlt code on the dltHub platform — no infrastructure to maintain. The prompt above already ends with "run it on dltHub", so your agent can take it there directly.
- Deploy & schedule — run the pipeline as a managed job with automatic retries.
- Monitor — observable job queues, alerting, and load metrics for every run.
- Transform — promote raw AWX loads into governed, documented models.
- Visualize & share — explore data in notebooks and publish live dashboards instead of static screenshots.
What other destinations can I load AWX data to?
dlt loads into any of these — only the destination argument changes:
| Destination | Example value |
|---|---|
| PostgreSQL | "postgres" |
| BigQuery | "bigquery" |
| Snowflake | "snowflake" |
| Redshift | "redshift" |
| Databricks | "databricks" |
| Filesystem (S3, GCS, Azure) | "filesystem" |
Set dlt.pipeline(destination="snowflake") and add credentials in .dlt/secrets.toml. On the dltHub platform the same pipeline runs against a managed Iceberg lakehouse. See the full destinations list.
Next steps
Was this page helpful?
Community Hub
Need more dlt context for AWX to DuckDB?
Request dlt skills, commands, AGENT.md files, and AI-native context.