duckdb or
parquet source reads them like any other table. Run the pipeline before hatchmark build, and the
dashboards show the latest load.
The steps load the issues and pull requests of a public GitHub repository, which needs no account.
For your own tools, dlt has verified sources
for many SaaS products and a REST API source
for any other JSON API.
1. Install dlt
In the project folder, create a Python environment and install dlt with its DuckDB destination:.venv/ to .gitignore.
2. Write the pipeline
add_limit(3)reads three pages, 300 rows, to try it out. Remove it to load every page.mergeonprimary_keyupdates the rows that changed since the last run instead of adding them again, so the file holds one row per issue.- Name the file differently from
dataset_name. Ingithub.duckdb, the schemagithuband the databasegithubshare a name, and dlt’s load fails withAmbiguous reference to catalog or schema "github". - A source that needs a key reads it from an environment variable or
.dlt/secrets.toml, never from the script; see credentials in dlt’s docs. Keep.dlt/secrets.tomlout of git.
3. Run it
github schema of data/saas.duckdb: one table per resource, here
issues, and its own bookkeeping tables, whose names start with _dlt.
- Nested objects become columns joined with a double underscore: the author’s login is
user__login, and a pull request’s URL ispull_request__url. - Lists become child tables, such as
issues__labels, whose_dlt_parent_idmatches the parent row’s_dlt_id. - A
mergeload also writes agithub_stagingschema, which no source needs.
4. Add the source
TIMESTAMP WITH TIME ZONE and read as time, so they are bucketed in the
project’s timezone. Run the pipeline and the build one after the other, not at the same time: the
build reads the file read-only, and dlt holds it while it loads. See
DuckDB files for how the file is read.
5. Define metrics on it
GitHub’s issues API returns pull requests too; a pull request is a row with apull_request__url.
Keep it up to date
Run the pipeline and then the build in the same scheduled job, such as a cron entry or a CI workflow:merge, each run fetches the issues again and updates the ones that changed. For a large
account, load only what changed since the last run with dlt’s
incremental loading.
Parquet files instead
dlt’s filesystem destination writes Parquet files. A localparquet source reads one file, so name each table’s file after the
table and replace it on every run:
.venv/bin/pip install "dlt[parquet]". The run writes data/github/issues.parquet:
bucket_url set to s3://, gs:// or az://, works with a
cloud storage source, whose path may be a glob that matches
every file dlt writes for a table.