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

[CT-3290] [Bug] Using --inline should exclude selectors.yml defaults #8943

Closed
2 tasks done
racheldaniel opened this issue Oct 30, 2023 · 4 comments · Fixed by #10264
Closed
2 tasks done

[CT-3290] [Bug] Using --inline should exclude selectors.yml defaults #8943

racheldaniel opened this issue Oct 30, 2023 · 4 comments · Fixed by #10264
Assignees
Labels
backport 1.8.latest bug Something isn't working Impact: Exp Medium Severity bug with minor impact that does not have resolution timeframe requirement

Comments

@racheldaniel
Copy link
Contributor

racheldaniel commented Oct 30, 2023

Is this a new bug in dbt-core?

  • I believe this is a new bug in dbt-core
  • I have searched the existing issues, and I could not find an existing issue for this bug

Current Behavior

If a default selector is defined in selectors.yml, that selector will still applied when the --inline flag is used with show or compile.

See slack thread for additional context

Expected Behavior

  • When we do dbt show --inline ... we expect default selectors to be ignored
  • make --inline and --select mutually exclusive for dbt show (do this at the click level)

Steps To Reproduce

  1. Add a default selector to a local dbt project's selectors.yml :
selectors:
  - name: test_selector
    description: Exclude everything
    default: true
    definition:
       method: package
       value: "foo"
  1. Using dbt-core 1.5+ (for support for --inline), run dbt compile --inline 'select 1'
  2. Observe that inline compile does not execute

Relevant log output

(dbt-core-1.6-local) racheldaniel:jaffle_shop/ (master✗) $ dbt compile --inline 'select 1'                                                                                                       [14:22:20]
19:22:26  Running with dbt=1.6.6
19:22:26  Registered adapter: postgres=1.6.6
19:22:26  Found 10 models, 3 seeds, 1 operation, 18 tests, 0 sources, 0 exposures, 0 metrics, 661 macros, 1 group, 0 semantic models
19:22:26  Using default selector test_selector
19:22:26
19:22:26  Nothing to do. Try checking your model configs and model specification args

Environment

- OS: MacOS Ventura 13.5.2
- Python: 3.8.10
- dbt: 1.6.6

Which database adapter are you using with dbt?

postgres

Additional Context

See #9269 (comment) for several specific cases where --inline doesn't work as desired.

@racheldaniel racheldaniel added bug Something isn't working triage labels Oct 30, 2023
@github-actions github-actions bot changed the title [Bug] Using --inline should exclude selectors.yml defaults [CT-3290] [Bug] Using --inline should exclude selectors.yml defaults Oct 30, 2023
@dbeatty10
Copy link
Contributor

From @jtcohen6:

This does feel like unexpected behavior / a bug to me. Using --inline is mutually exclusive with using --select, so it would make sense to me that it should fully disregard all selection syntax.

I'd hope it could be a (relatively) quick fix here.

@dbeatty10 dbeatty10 removed the triage label Oct 30, 2023
@graciegoheen graciegoheen added Medium Severity bug with minor impact that does not have resolution timeframe requirement High Severity bug with significant impact that should be resolved in a reasonable timeframe Impact: Exp and removed Medium Severity bug with minor impact that does not have resolution timeframe requirement High Severity bug with significant impact that should be resolved in a reasonable timeframe labels Nov 21, 2023
@graciegoheen
Copy link
Contributor

Notes from estimation:

  • this could be related to how default selection works - maybe instead of piping this through we would just add a selection criteria when --inline

@aranke
Copy link
Member

aranke commented May 20, 2024

This error also surfaces if you pass in both --select and --inline to dbt show when they shouldn't be:

❯ dbt show --select stg_orders
18:00:47  Running with dbt=1.7.9
18:00:47  Registered adapter: duckdb=1.7.3
18:00:47  Found 5 models, 3 seeds, 20 tests, 0 sources, 0 exposures, 0 metrics, 772 macros, 0 groups, 0 semantic models
18:00:47  
18:00:47  Concurrency: 24 threads (target='dev')
18:00:47  
18:00:48  Previewing node 'stg_orders':
| order_id | customer_id | order_date | status    |
| -------- | ----------- | ---------- | --------- |
|        1 |           1 | 2018-01-01 | returned  |
|        2 |           3 | 2018-01-02 | completed |
|        3 |          94 | 2018-01-04 | completed |
|        4 |          50 | 2018-01-05 | completed |
|        5 |          64 | 2018-01-05 | completed |

❯ dbt show --inline 'select 1 as foo'
18:01:15  Running with dbt=1.7.9
18:01:16  Registered adapter: duckdb=1.7.3
18:01:16  Found 5 models, 3 seeds, 20 tests, 0 sources, 0 exposures, 0 metrics, 772 macros, 0 groups, 0 semantic models
18:01:16  
18:01:16  Concurrency: 24 threads (target='dev')
18:01:16  
18:01:16  Previewing inline node:
| foo |
| --- |
|   1 |


❯ dbt show --select stg_orders --inline 'select 1 as foo'
18:00:58  Running with dbt=1.7.9
18:00:59  Registered adapter: duckdb=1.7.3
18:00:59  Found 5 models, 3 seeds, 20 tests, 0 sources, 0 exposures, 0 metrics, 772 macros, 0 groups, 0 semantic models
18:00:59  
18:00:59  Nothing to do. Try checking your model configs and model specification args

@graciegoheen
Copy link
Contributor

graciegoheen commented May 22, 2024

Another related bug #9269 -> dbt core should disregard selection / selectors altogether when running in inline mode during "interactive compile" and dbt show.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport 1.8.latest bug Something isn't working Impact: Exp Medium Severity bug with minor impact that does not have resolution timeframe requirement
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants