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

Switch from dots to underscores for versioning #3316

Merged
merged 6 commits into from
Jul 14, 2023
Merged

Conversation

joellabes
Copy link
Contributor

What are you changing in this pull request and why?

The docs for model versioning use dim_customers.v1 in a lot of places, instead of dim_customers_v1. This was an original proposal for model version naming that got abandoned due to database peculiarities.

This PR swaps out the . for _ everywhere except for when it's being used in a model's fully qualified name (where the dots are actually how it's represented.)

I'm assuming this was an oversight as the product evolved; maybe it's on purpose across the board? If so then this is more up for debate, but IMO the more time we spend talking about versioned models along our preferred naming scheme (single digit with an underscore) the better. The fact that we use dots behind the scenes isn't relevant to most folks.

@joellabes joellabes requested a review from jtcohen6 May 1, 2023 23:05
@joellabes joellabes requested a review from a team as a code owner May 1, 2023 23:05
@netlify
Copy link

netlify bot commented May 1, 2023

Deploy Preview for docs-getdbt-com ready!

Name Link
🔨 Latest commit d872aca
🔍 Latest deploy log https://app.netlify.com/sites/docs-getdbt-com/deploys/64b1b0cc44a4380008b1bf6e
😎 Deploy Preview https://deploy-preview-3316--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: x-small This change will take under 3 hours to fix. labels May 1, 2023
Copy link
Contributor

@nghi-ly nghi-ly left a comment

Choose a reason for hiding this comment

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

🚢

@joellabes
Copy link
Contributor Author

Will wait to merge until @jtcohen6 gets a chance to comment if he wants to, in case I am misinterpreting his goals

@jtcohen6
Copy link
Collaborator

jtcohen6 commented May 2, 2023

@joellabes I'm open to this change if you think it's clarifying / less confusing for users!

Here's my thought process:

  • The model's name is always just dim_customers. It has a new version component, which is 1, 2, etc.
  • In the model's unique_id and fqn, these components are dot-separated: model.<project_name>.dim_customers.v1 and <project_name>.<subdirectory>.dim_customers.v1, respectively
  • Following the default naming conventions, the model's file name and database alias will both be dim_customers_v1 (underscore)

So when talking about the model as a dbt node/resource, in abstract of its SQL file definition and its materialized relation identifier, my inclination was to use the dot (dim_customers.v1). For example, I can select the model with the dot, but I can't with the underscore:

$ dbt --quiet ls -s dim_customers.v1
my_dbt_project.dim_customers.v1
$ dbt --quiet ls -s dim_customers_v1
... nothing ...

Should we just fix that, and support selecting versioned models as <model_name>_v<v>?

@joellabes
Copy link
Contributor Author

Hmm!

Should we just fix that, and support selecting versioned models as <model_name>_v<v>?

Yeah I think this is a good idea regardless, to reduce surprises.

Don't know how it makes me feel about the writing in the docs - the dots are righter, but unless you're poking around in the artifacts you're never going to interact with them right?

@jtcohen6 jtcohen6 added idea Proposes an idea for new content dbt-core v1.6 Docs impact for the v1.6 release (July 2023) labels Jul 13, 2023
@jtcohen6
Copy link
Collaborator

Should we just fix that, and support selecting versioned models as <model_name>_v<v>?

Yeah I think this is a good idea regardless, to reduce surprises.

We did this for v1.6: dbt-labs/dbt-core#7995

Let's move ahead with this PR!

@jtcohen6 jtcohen6 added this to the dbt Core v1.6 Documentation milestone Jul 13, 2023
Copy link
Contributor

@dbeatty10 dbeatty10 left a comment

Choose a reason for hiding this comment

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

thank.you thank_you @joellabes !

@dbeatty10 dbeatty10 enabled auto-merge (squash) July 14, 2023 20:32
@dbeatty10 dbeatty10 merged commit 653f404 into current Jul 14, 2023
@dbeatty10 dbeatty10 deleted the joellabes-patch-1 branch July 14, 2023 20:38
@runleonarun runleonarun removed the idea Proposes an idea for new content label Mar 13, 2024
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 dbt-core v1.6 Docs impact for the v1.6 release (July 2023) size: x-small This change will take under 3 hours to fix.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants