Fix member_months extension passthrough double-strip (#1347)#1349
Open
gopidaxhealthcaresolutions wants to merge 2 commits into
Open
Conversation
✅ Deploy Preview for thetuvaproject canceled.
|
The member_months chain stripped the passthrough prefix in an early CTE and then asked select_extension_columns() for the original prefixed name again from a CTE that no longer had it, breaking compilation when passthrough.strip is true (invalid identifier on the prefixed column). Follow the established convention: intermediate models pass strip_prefix=false so the prefix is preserved (and downstream introspection can still identify extension columns), and only the final model (core__member_months) strips. Applies strip_prefix=false to the four intermediate calls in core__int_member_months and core__stg_claims_member_months.
gopidaxhealthcaresolutions
force-pushed
the
fix/1347-member-months-passthrough-strip
branch
from
June 22, 2026 08:46
254e8de to
8deb36b
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.
@
Closes #1347
What happens
With
passthrough.strip: trueand an extension column on eligibility (e.g.ext_cell_phone), the member_months models fail to compile:Why
The prefix gets stripped twice.
select_extension_columns()always discovers column names by introspecting the original input relation (e.g.normalized__eligibility), so it keeps asking forext_cell_phone. But an upstream CTE has already renamed that column tocell_phonevia the first (stripping) call, so the second call references a column that no longer exists.Fix
This follows the convention already used by every other intermediate model in the repo (e.g.
int_eligibility_casting,core__int_patient_casting, thecore__stg_claims_*models): intermediate models passstrip_prefix=falseso the prefix is preserved end-to-end (and downstream introspection can still identify the extension columns by prefix), and only the final model strips.The prefix should be stripped exactly once, at the final output (
core__member_months, which already calls the macro with the default strip behavior). This PR addsstrip_prefix=falseto the four intermediate call sites that were missing it:models/core/staging/core__int_member_months.sql(2 calls:stg_eligibility,joined)models/core/staging/core__stg_claims_member_months.sql(2 calls)Behavior impact
strip: false): no change — extension columns keep their prefix through the whole chain, exactly as before.strip: true: previously a hard compile failure; now compiles and the prefix is stripped once in the finalcore__member_monthsoutput.Testing
Reproduced both the failure and the fix locally on DuckDB with a focused project mirroring the exact double-call CTE chain (
int→stg→final) and anext_-prefixed eligibility column:strip: true):Binder Error: Values list "a" does not have a column named "ext_cell_phone"— matches the reported bug.strip: true): chain compiles and runs; final output column iscell_phone(stripped once), data intact.strip: false, default): final output column isext_cell_phone(preserved) — confirms no regression for existing users.The existing
extension_column_unit_tests.ymlunit tests for this chain also pass.@