Fix ref macro override to support package args and version keyword - #316
Open
haritamar wants to merge 1 commit into
Open
Fix ref macro override to support package args and version keyword#316haritamar wants to merge 1 commit into
haritamar wants to merge 1 commit into
Conversation
The overridden ref macro only accepted (model_name, v=None), which
broke two valid dbt calling conventions:
- ref('package', 'model') - cross-package/project refs
- ref('model', version=1) - versioned models via the `version` kwarg
Updated the signature to match the correct interface per the dbt docs
on builtins overrides, mirroring the same fix applied in elementary-data/elementary#404708b.
Fixes dremio#232
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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
Fix the
refmacro override inbuiltins.sqlto correctly support all dbtref()calling conventions.Description
The current override has the signature
ref(model_name, v=None), which breaks two valid dbt calling conventions:ref('package', 'model')for cross-package/project refs: the second positional arg was incorrectly interpreted as a version number instead of a model name.versionkeyword argument —ref('model', version=1)was not accepted at all (onlyv=was supported).The fix adopts the correct interface per the dbt docs on builtins overrides:
Note: the same bug was independently identified and worked around in elementary-data/elementary, which added a local
refoverride specifically to compensate for this dbt-dremio issue.Test Results
Manually verified the macro logic against all calling forms:
ref('model')— unchanged behaviourref('package', 'model')— now works correctlyref('model', v=1)— unchanged behaviourref('model', version=1)— now works correctlyChangelog
Contributor License Agreement
Related Issue
Fixes #232