-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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-3487] [Bug] dbt show --inline
does not work when all models are disabled in dbt_project.yml
#9269
Comments
dbt show --inline
does not work when non-default target
is specifieddbt show --inline
does not work when non-default target
is specified
@pgoslatara Do you know what is different between your dbt project when you use different targets? It looks like you are able to successfully use This makes me think it might have something to do with target-specific logic you have within your project. The only thing that I can see that is different in your example output is that the first two have this warning (but the last one doesn't):
I tried to reproduce the same issue you are seeing, but I wasn't able. See below for the files and commands that I used. Could you try tweaking these example files to see the same unexpected behavior that you described? FilesThese are the only two files I put in my project (no models or anything else):
name: "my_project"
version: "1.0.0"
config-version: 2
profile: "bigquery"
clean-targets:
- dbt_packages
- '{{ env_var("DBT_TARGET_PATH", "target") }}'
- '{{ env_var("DBT_LOG_PATH", "logs") }}'
bigquery:
target: blue
outputs:
dev:
method: service-account
keyfile: '{{ env_var(''BIGQUERY_SERVICE_KEY_PATH'') }}'
project: '{{ env_var(''BIGQUERY_TEST_DATABASE'') }}'
schema: dbt_dbeatty
threads: 10
type: bigquery
dev2:
method: service-account
keyfile: '{{ env_var(''BIGQUERY_SERVICE_KEY_PATH'') }}'
project: '{{ env_var(''BIGQUERY_TEST_DATABASE'') }}'
schema: dbt_dbeatty
threads: 10
type: bigquery Commandsdbt show --inline "SELECT 1 AS id" --target dev
dbt show --inline "SELECT 1 AS id" --target dev2 Output
|
@dbeatty10 Thanks for looking into this. Good idea on the project configuration, I figured out what's causing this issue. We have some jinja logic that disables our models when any target other than "dev" is used (I know, it's complex 😃). Essentially what's happening is that when models are disabled then To reproduce, add this to your models:
+enabled: false Regardless of what target you select, running |
dbt show --inline
does not work when non-default target
is specifieddbt show --inline
does not work when all models are disabled in dbt_project.yml
ReprexDepending on the content of dbt show --inline "select 1 as id" This works:
{{ config(enabled=false) }}
select 1 as id But this doesn't:
models:
+enabled: false |
I've traced this issue to this line: for uid in self.job_queue.get_selected_nodes():
|
Acceptance criteriadbt core should disregard selection / selectors altogether when running in inline mode during "interactive compile" and dbt show. i.e., whenever the
In the case of |
We've identified a handful of edge cases where Case 1See #9269 (comment) Case 2dbt compile --select something_that_doesnt_match_any_nodes --inline "select 1 as id"
dbt show --select something_that_doesnt_match_any_nodes --inline "select 1 as id" Case 3
selectors:
- name: no_nodes_for_you
description: Something that matches no nodes
default: false
definition:
union:
- method: fqn
value: "*"
- exclude:
- method: fqn
value: "*" dbt compile --selector no_nodes_for_you --inline "select 1 as id"
dbt show --selector no_nodes_for_you --inline "select 1 as id" Case 4Same default: true dbt compile --inline "select 1 as id"
dbt show --inline "select 1 as id" |
This is a duplicate of #8943, so I've reassigned it to me. |
@graciegoheen When all models are disabled via dbt_project.yml, that includes the inline model node that's created with "--inline". So it's not clear that that is actually a bug, although it is somewhat unexpected. |
Is this a new bug in dbt-core?
Current Behavior
When I run
dbt show --inline
it works. When I add a--target
flag it does not work.Expected Behavior
dbt show
works when a target is supplied.Steps To Reproduce
I'm running the latest version of
dbt-biguery
with thisprofiles.yml
:Note that
dev2
is an exact copy ofdev
.Run the following commands and observe differing behaviour:
The first 2 commands return a result, the third command does not.
Relevant log output
Environment
Which database adapter are you using with dbt?
bigquery
Additional Context
No response
The text was updated successfully, but these errors were encountered: