D.ata C.ollection F.ramework - Define a data source, run dcf, query the data
Project description
dcf
D.ata C.ollection F.ramework
uvx --from dcf-core dcf init
How it works
- Define a data collector in YAML — source, schema, cadence
- Run it with
dcf run - Query data from your data lake
Quickstart
Get real data. From an API. Into your Lakehouse. Query it with SQL. In 5 lines.
mkdir dcf-demo && cd dcf-demo
uvx --from dcf-core dcf init
uv sync
uv run dcf run so_questions
uv run dcf query 'SELECT * FROM stackoverflow.so_questions'
dcf init creates pyproject.toml, project.yml, .gitignore, collectors/, and an example collector.
Example
dcf collector
name: so_questions
namespace: stackoverflow
source:
type: http
url: https://api.stackexchange.com/2.3/questions
method: GET
response:
records_path: items
params:
- {name: site, type: string, value: stackoverflow}
- {name: tagged, type: string, value: "python;data-engineering"}
- {name: order, type: string, value: asc}
- {name: sort, type: string, value: creation}
- {name: pagesize, type: integer, value: 100}
- {name: fromdate, type: string, format: "%s"}
- {name: todate, type: string, format: "%s"}
schema:
columns:
- {name: question_id, path: question_id, type: integer}
- {name: title, path: title, type: string}
- {name: score, path: score, type: integer}
- {name: answer_count, path: answer_count, type: integer}
- {name: view_count, path: view_count, type: integer}
- {name: creation_date, path: creation_date, type: integer}
- {name: link, path: link, type: string}
cadence:
strategy: incremental
primary_key: question_id
iterate:
- type: date_range
params: [fromdate, todate]
start: "2024-01-01"
end: today
step: 30 days
deployment:
schedule: "0 8 * * *"
dcf run
uv run dcf run so_questions
dcf query
uv run dcf query 'SELECT * FROM stackoverflow.so_questions LIMIT 5'
More features
- Importing collectors from dcf-hub, GitHub, or PyPI —
dcf import - Authenticated collectors — bearer tokens, API keys,
{{ env.VAR }} - Collector config reference — full YAML field reference
Contributing
git clone https://github.com/zephschafer/dcf && cd dcf && uv sync
Point a local project at your checkout:
[tool.uv.sources]
dcf-core = { path = "../dcf", editable = true }
To verify changes:
uv run dcf run so_questions
uv run dcf query 'SELECT * FROM stackoverflow.so_questions'
Releasing: bump version in pyproject.toml and push to main — GitHub Actions publishes to PyPI automatically.
Package structure
dcf/
├── cli.py Entry point (Typer)
├── config/
│ ├── models.py Pydantic models for collector YAML
│ └── loader.py YAML loading + env var resolution
├── engine/
│ ├── runner.py Outer loop (iterate → fetch → project → write)
│ ├── fetcher.py HTTP and Python source fetchers
│ ├── iterator.py Date range and categorical iteration
│ ├── projector.py Schema projection and path extraction
│ └── transforms.py Column transforms
├── writer/
│ └── iceberg.py Write strategies (incremental / append / full_refresh)
└── gcp/ GCP auth, provisioning, Terraform wrappers
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file dcf_core-1.0.6.tar.gz.
File metadata
- Download URL: dcf_core-1.0.6.tar.gz
- Upload date:
- Size: 64.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.11.15 {"installer":{"name":"uv","version":"0.11.15","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
522730d098651a58be59792bea1c36bd8115dd2c41ea3a61da7d99ba3ae7f8ee
|
|
| MD5 |
9687c076112f9cc7b7358f2a65ee8c39
|
|
| BLAKE2b-256 |
0fcef75c1a7b3c2f22ca0ac6c5c5e117ce08c3da72d8e91cc8b65e0961b9cf8b
|
File details
Details for the file dcf_core-1.0.6-py3-none-any.whl.
File metadata
- Download URL: dcf_core-1.0.6-py3-none-any.whl
- Upload date:
- Size: 68.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.11.15 {"installer":{"name":"uv","version":"0.11.15","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
34f94060ee0e8b0d9acdeb045f6a27383577537a4d863266003433fc47974faf
|
|
| MD5 |
3eedc1c0a38bb2f74b45b110dc1486f9
|
|
| BLAKE2b-256 |
465371b9730bc1a2e7840debbe0023aa5463aeab04a90c5a9cb2c83bda8c2d64
|