Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update builtins.md #4050

Merged
merged 8 commits into from
Sep 12, 2023
Merged

Update builtins.md #4050

merged 8 commits into from
Sep 12, 2023

Conversation

mirnawong1
Copy link
Contributor

@mirnawong1 mirnawong1 commented Sep 8, 2023

adding 1.5+ and <=v1.5 versioning and explains macro

Resolves #3802

adding 1.5+ and <=v1.5 versioning and macro explaining for ref maco
@mirnawong1 mirnawong1 requested a review from a team as a code owner September 8, 2023 15:37
@netlify
Copy link

netlify bot commented Sep 8, 2023

Deploy Preview for docs-getdbt-com ready!

Name Link
🔨 Latest commit 25367e6
🔍 Latest deploy log https://app.netlify.com/sites/docs-getdbt-com/deploys/650035c8a0a1c4000820c896
😎 Deploy Preview https://deploy-preview-4050--docs-getdbt-com.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@github-actions github-actions bot added content Improvements or additions to content size: small This change will take 1 to 2 days to address Docs team Authored by the Docs team @dbt Labs labels Sep 8, 2023
Copy link
Collaborator

@jtcohen6 jtcohen6 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mirnawong1 Thanks so much for spearheading this!

What do you think of some sort of callout that this whole builtins business is a pretty "advanced" use case? Users should be aware that they will need to maintain/update these overrides as they upgrade into the future.

website/docs/reference/dbt-jinja-functions/builtins.md Outdated Show resolved Hide resolved
website/docs/reference/dbt-jinja-functions/builtins.md Outdated Show resolved Hide resolved
```
</VersionBlock>

<VersionBlock lastVersion="1.5">
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The previous examples actually did something different — either updating or excluding the database component of the returned Relation — whereas the example above is just the same as default built-in ref.

return a Relation with the database name overridden to dev

I think we should update the example above to do the same:

-- call builtins.ref based on provided positional arguments
{% set rel = None %}
{% if packagename is not none %}
    {% set rel = return(builtins.ref(packagename, modelname, version=version)) %}
{% else %}
    {% set rel = return(builtins.ref(modelname, version=version)) %}
{% endif %}

-- finally, override the database name with "dev"
{% set newrel = rel.replace_path(database="dev") %}
{% do return(newrel) %}

website/docs/reference/dbt-jinja-functions/builtins.md Outdated Show resolved Hide resolved
@mirnawong1
Copy link
Contributor Author

hey @jtcohen6 , thank you for this awesome feedback! I've made changes based on your suggestions - how does it look now?

@mirnawong1 mirnawong1 merged commit 4fd5aa8 into current Sep 12, 2023
@mirnawong1 mirnawong1 deleted the mirnawong1-patch-5 branch September 12, 2023 10:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
content Improvements or additions to content Docs team Authored by the Docs team @dbt Labs size: small This change will take 1 to 2 days to address
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Updating the builtin ref/source functions is most likely different in dbt 1.5+
2 participants