Add source_column + POST /preaggs/register for external tables#2338
Draft
shangyian wants to merge 2 commits into
Draft
Add source_column + POST /preaggs/register for external tables#2338shangyian wants to merge 2 commits into
shangyian wants to merge 2 commits into
Conversation
Adds a source_column field to PreAggMeasure and a /preaggs/register endpoint that adopts an externally-built pre-aggregation table (one DJ did not generate or run). DJ decomposes the requested metrics into component measures, binds each to a physical column via measure_columns, validates them against the table (declared columns exist; every measure_columns key is an is_measure metric; every component measure of the requested metrics is covered), records the PreAggregation, and — when a valid_through_ts is supplied — sets availability so grain resolution can route queries to it. The query builder (get_preagg_measure_column) now prefers a measure's source_column, so registered external columns are used at query time. No migration: the DJ-generated measures SQL is stored (informational) so `sql` stays non-null, and external pre-aggs are identified by source_column presence. EXTERNAL strategy marker, nullable sql, and a stable name column are deferred to the YAML/reconcile work (PR 4). Stacked on the is_measure branch. Advances DataJunction#2118. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
✅ Deploy Preview for thriving-cassata-78ae72 canceled.
|
shangyian
force-pushed
the
preagg-register
branch
from
July 17, 2026 23:25
d7deb61 to
94245d7
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds a
source_columnfield toPreAggMeasureand a/preaggs/registerendpoint that adopts an externally-built pre-aggregation table (one DJ did not generate or run). DJ decomposes the requested metrics into component measures, binds each to a physical column viameasure_columns, validates them against the table (everymeasure_columnskey is anis_measuremetric and every component measure of the requested metrics is covered), records thePreAggregation, and when avalid_through_ts` is supplied, sets availability so grain resolution can route queries to it.The query builder (
get_preagg_measure_column) now prefers a measure'ssource_column, so registered external columns are used at query time.Advances #2118.
Test Plan
make checkpassesmake testshows 100% unit test coverageDeployment Plan