-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
[CT-2407] [Bug] dbt can't find snapshots using their filenames if mixed cased but only if inside a subfolder #7346
Comments
I was able to reproduce what you reported @jeremyyeo -- as always, thank you for such a helpful reprex 🤩 tl;drCheck out wildcard selection syntax for Unix-style globbing! $ dbt ls -s '*.snaPPy_2.*'
my_dbt_project.in_subfolder.snaPPy_2.snappy_2 More detailReading your description initially, it looked like case-sensitivity was somehow coming into play. But after renaming each of the snapshot files, it looks like it is something different than that (see reprex below). Specifically, node names are the same as filenames for models, but this is not the case for snapshots. It's somewhat accidental that ReprexReprexFirst, I updated most of the file names to be both lowercase and distinct from the snapshot name: mv snapshots/snaPPy_1.sql snapshots/snappy_one.sql
mv snapshots/in_subfolder/snaPPy_2.sql snapshots/in_subfolder/snappy_two.sql
mkdir -p snapshots/in_subfolder/in_subsubfolder/
mv snapshots/in_subfolder/snappy_three.sql snapshots/in_subfolder/in_subsubfolder/snappy_three.sql Then took a look at a variety of selection syntax options: $ dbt ls -s in_sub
my_dbt_project.in_sub.bAr
$ dbt ls -s in_subfolder
my_dbt_project.in_subfolder.snappy_two.snappy_2
my_dbt_project.in_subfolder.snappy_three.snappy_3
$ dbt ls -s bAr
my_dbt_project.in_sub.bAr
$ dbt ls -s snappy_1
my_dbt_project.snappy_one.snappy_1
$ dbt ls -s snappy_2
my_dbt_project.in_subfolder.snappy_two.snappy_2
$ dbt ls -s snappy_one
my_dbt_project.snappy_one.snappy_1
$ dbt ls -s snappy_two
16:10:30 The selection criterion 'snappy_two' does not match any nodes
16:10:30 No nodes selected!
$ dbt ls -s in_subsubfolder
16:24:35 The selection criterion 'in_subsubfolder' does not match any nodes
16:24:35 No nodes selected!
$ dbt ls -s in_subfolder.in_subsubfolder
my_dbt_project.in_subfolder.in_subsubfolder.snappy_three.snappy_3
# wildcard selection syntax
$ dbt ls -s '*.snappy_two.*'
my_dbt_project.in_subfolder.snappy_two.snappy_2
# file selection syntax
$ dbt ls -s snapshots/in_subfolder/snappy_two.sql
my_dbt_project.in_subfolder.snappy_two.snappy_2 I think the selection for snapshots is behaving as expected in this case, and I'm inclined to close this in favor of using the wildcard selection syntax or file selection syntax instead. Before I close, are there any key considerations I might be overlooking? |
@dbeatty10 I didn't understand your last comment when you said "before I close" do you mean close the bug report? We noticed this behavior because the snapshots are showing up in the DAG sometimes and not others. We suspected it had something to do with subfolders but couldn't nail down what (we're very new to dbt). Are you saying if they're snake case it works so it's not a bug? |
@markproctor1 We're going to do an update to fix this for you, we're just going to make that update in our Cloud software (which we track in Jira tickets) rather than Core (which we track in GitHub issues like this one). The root cause is when the filename differs from the name of the snapshot. In the example below, if you change the filename to be the same as the snapshot name, it should work:
I'm going to close this issue, but please don't think we are closing this altogether: our Cloud team still has visibility on this. And please feel free to ask any follow-up questions -- although this issue is labeled as "closed", we're listening and will respond 😄 |
Is this a new bug in dbt-core?
Current Behavior
This one is really strange - for some reason dbt can't find snapshots via their mixedCased file names if inside a subfolder.
Note for readers of this issue - you are encouraged to follow
snake_case
when naming stuff (for example: dbt-labs/docs.getdbt.com#1659) which would avoid a scenario like this.Expected Behavior
dbt should find
snappy_2
/snaPPy_2.sql
just like it did for modelbAr.sql
.Steps To Reproduce
Project setup:
Nodes (pay close attention to the filenames):
Relevant log output
No response
Environment
Which database adapter are you using with dbt?
snowflake
Additional Context
For more info on why this was brought up - basically the Cloud IDE uses the syntax:
To draw the lineage on an active file/node. Due to this issue - the snapshot
snaPPy_2.sql
/snappy_2
isn't rendered in the Cloud IDE when it is the active file - unless you tweak the selection to be the string"snappy_2"
(as opposed to it's default selection when you open up the file"2+snaPPy_2+2"
) - then it's okay.Internal JIRA: https://dbtlabs.atlassian.net/browse/XP-2094
The text was updated successfully, but these errors were encountered: