Skip to content

Fix!: depend on all attributes of dbt model when passed to a macro#5269

Merged
georgesittas merged 6 commits intomainfrom
jo/track_model_attributes
Sep 4, 2025
Merged

Fix!: depend on all attributes of dbt model when passed to a macro#5269
georgesittas merged 6 commits intomainfrom
jo/track_model_attributes

Conversation

@georgesittas
Copy link
Contributor

@georgesittas georgesittas commented Sep 1, 2025

When we pass the dbt model keyword to a macro (e.g., {{ foo(model) }}), we can't easily track the attributes that are actually used, because the argument may be aliased and hence tracking actual uses of model requires a proper data flow analysis.

This PR handles this case by conservatively including all of model's supported attributes if a "standalone" reference is detected. We decided to exclude raw_code to reduce the snapshot's payload size, since we can access it through the JinjaQuery node directly.

P.S.: may need to revisit before merging to see if we can migrate this properly.

@georgesittas georgesittas requested review from a team and izeigerman September 1, 2025 12:56
@georgesittas georgesittas force-pushed the jo/track_model_attributes branch from fd4ec21 to a27ed55 Compare September 1, 2025 13:29
@georgesittas georgesittas force-pushed the jo/track_model_attributes branch 3 times, most recently from f8bd60b to 3384035 Compare September 3, 2025 11:24
@georgesittas georgesittas force-pushed the jo/track_model_attributes branch from 3384035 to f1e03a8 Compare September 3, 2025 19:34
@georgesittas georgesittas force-pushed the jo/track_model_attributes branch from f1e03a8 to 8919c48 Compare September 3, 2025 19:34
@georgesittas georgesittas force-pushed the jo/track_model_attributes branch 2 times, most recently from 6112d57 to 534aadd Compare September 4, 2025 00:05
@georgesittas georgesittas merged commit 5ade723 into main Sep 4, 2025
36 checks passed
@georgesittas georgesittas deleted the jo/track_model_attributes branch September 4, 2025 16:37
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.

3 participants