Skip to content

refactor(dagster): load raw tables through a shared parquet loader and result builders - #98

Draft
tillywoodfield wants to merge 2 commits into
devfrom
refactor/36-raw-table-helpers
Draft

tillywoodfield wants to merge 2 commits into
devfrom
refactor/36-raw-table-helpers

Conversation

@tillywoodfield

@tillywoodfield tillywoodfield commented Nov 16, 2026 •

Copy link
Copy Markdown
Collaborator

What & why

The eight raw table assets and the eight raw metadata assets each repeated the same load code: create the schema, load the parquet file, count rows, and report dagster/table_name, dagster/row_count and the table_not_empty check. The parquet load is now one Dagster-free function beside load_extraction_metadata, and the result each asset returns is built in one place.

Part of #36

Changes

  • src/dfo_pipelines/extraction/parquet.py: load_parquet, which loads a parquet file into a table on a DuckDB connection, aliasing columns by position when given renames (DAC's case-colliding columns)
  • src/dfo_pipelines/defs/raw_tables.py: raw_table_result, with the table metadata and the table_not_empty check, and metadata_table_result, with the table metadata only
  • The raw table and raw metadata assets of WEO, CRS, DAC1, DAC2A, DAC2B, IDS, imputed multilateral sectors and climate finance load with load_parquet or load_extraction_metadata and return the matching result. Decorators, asset names, signatures and docstrings are unchanged
  • .claude/skills/building-pipelines/references/layers.md names the four functions in the raw load step

Notes for reviewers

  • Output is unchanged by design. The asset graph (keys, deps, checks, automation, code versions, descriptions) dumped from dev and from this branch is identical, and every existing test passes with no test file edited.
  • load_parquet and load_extraction_metadata are DuckDB-specific. When BigQuery support arrives, both get a BigQuery counterpart, which is when they move to wherever the warehouse operations end up.
  • The decorators (check specs, automation, kinds) are still repeated per asset. A raw-layer asset factory stacked on this PR removes them.

Testing: the full CI workflow ran locally (pre-commit, dg check defs, dbt build with 1430 passing, pytest with 509 passed and 9 skipped). The raw table and raw metadata assets of the seven sources with local raw files were materialised on dev and on this branch into separate DuckDB files: all 14 tables have identical schemas and rows (up to 11.4 million rows for imputed multilateral sectors), and the metadata and check results match. Climate finance has no local raw files, so only its tests cover it.

Checklist

  • Addresses one issue, linked above
  • Tests updated where relevant
  • Docs updated where relevant
  • Self-reviewed the diff

Co-Authored-By: Claude noreply@anthropic.com

@tillywoodfield

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 16, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-16T16:57:52.931376Z 70ad256 Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Bravo.

Reviewed commit: 70ad256208

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@tillywoodfield tillywoodfield changed the title refactor(dagster): load raw tables and raw metadata through shared functions refactor(dagster): load raw tables through a shared parquet loader and result builders Nov 16, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant