-
Notifications
You must be signed in to change notification settings - Fork 977
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 docs to clarify the way aliases are used in CTEs #5795
Update docs to clarify the way aliases are used in CTEs #5795
Conversation
Hello!👋 Thanks for contributing to the dbt product documentation and opening this pull request! ✨ |
@jeancochrane is attempting to deploy a commit to the dbt-labs Team on Vercel. A member of the Team first needs to authorize it. |
| Model | Config | Relation Type | Database Identifier | | ||
| ----- | ------ | --------------| ------------------- | | ||
| ga_sessions.sql | {{ config(materialization='view') }} | <Term id="view" /> | "analytics"."ga_sessions" | | ||
| ga_sessions.sql | {{ config(materialization='view', alias='sessions') }} | <Term id="view" /> | "analytics"."sessions" | | ||
| ga_sessions.sql | {{ config(materialization='ephemeral') }} | <Term id="cte" /> | "\__dbt\__cte\__ga_sessions" | | ||
| ga_sessions.sql | {{ config(materialization='ephemeral', alias='sessions') }} | <Term id="cte" /> | "\__dbt\__cte\__sessions" | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not actually sure whether it's helpful to document the CTE identifier behavior here, so I understand if you'd prefer to keep this table focused on the alias rather than explaining the different behavior of ephemeral materialization.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very helpful! Thank you
|
||
### Why alias model names? | ||
The names of schemas and tables are effectively the "user interface" of your <Term id="data-warehouse" />. Well-named schemas and tables can help provide clarity and direction for consumers of this data. In combination with [custom schemas](/docs/build/custom-schemas), model aliasing is a powerful mechanism for designing your warehouse. | ||
|
||
### Usage | ||
The `alias` config can be used to change the name of a model's identifier in the database. The following <Term id="table" /> shows examples of database identifiers for models both with, and without, a supplied `alias`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tweaked this line to remove the misleading <Term>
component, since in this case we're not actually talking about a relation (which is what the term documents), we're just referencing the markup table that follows.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good call! Thank you
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks great @jeancochrane Thank you so much!
Not sure why the links weren't taking with the anchor. Will have to figure out what's causing that to fail.
Thanks for getting this over the line @matthewshaver! Just a quick flag that per the note in the PR description, the behavior described in this PR is not technically correct until dbt-labs/dbt-core#10290 and dbt-labs/dbt-adapters#236 get merged and released. I'll leave it to @dbeatty10 to decide the priority on those PRs, as the person who has been reviewing them so far. |
Thanks for calling this out @jeancochrane. @matthewshaver could we revert this docs PR until dbt-labs/dbt-core#10290 and dbt-labs/dbt-adapters#236 are included in a release? |
What are you changing in this pull request and why?
This PR updates the docs to reflect the bugfix made in dbt-labs/dbt-core#10290 and dbt-labs/dbt-adapters#236 to bring the identifiers used for CTEs in line with the identifiers used for tables and views.
Checklist