[Feature] Use `--quiet` by default for `dbt show`
Is this your first time submitting a feature request?
- [X] I have read the expectations for open source contributors
- [X] I have searched the existing issues, and I could not find an existing issue for this feature
- [X] I am requesting a straightforward extension of existing dbt functionality, rather than a Big Idea better suited to a discussion
Describe the feature
As described in https://github.com/dbt-labs/dbt-core/issues/9840, It is often useful to pipe or redirect JSON output of dbt show for further downstream processing with a tool like the Python built-in json.tool or the jq swiss army knife.
It would be nice if the syntax were as simple as this to pipe JSON output to a downstream tool:
dbt show -s my_model --output json | python -m json.tool --json-lines
We'd want the --inline flag to be treated the same way as if --select we given instead.
Describe alternatives you've considered
The problem is that we currently need to do some gymnastics with --log-format, --output, and some downstream filtering to extract the desired JSON object 😢
It's certainly possible to require usage of the -q / --quiet flag, but it would be harder for folks to discover that way. If someone passes --output json, they probably want only JSON.
Who will this benefit?
Anyone that want to do any JSON post-processing in a terminal.
Are you interested in contributing this feature?
No response
Anything else?
We'd probably want the same behavior for all three of these subcommands:
show(assuming a single node is selected)compile(when a single node is selected)list(regardless the number of nodes selected)
See https://github.com/dbt-labs/dbt-core/issues/7994 for more detail about dbt list specifically.
This just caught me out too, so wanted to note that it might not have to only be for JSON output.
I ran an inline query and got all the boilerplate:
(dbt-prod) joel@Joel-Labes joel-sandbox % dbt show --inline "select * from ANALYTICS_DEV.dbt_jlabes.salary_data"
04:01:45 Running with dbt=1.8.2
04:01:45 Registered adapter: snowflake=1.8.2
04:01:46 Found 3 models, 1 snapshot, 1 test, 1 seed, 1 operation, 1 sql operation, 614 macros
04:01:46
04:01:48 Concurrency: 8 threads (target='dev')
04:01:48
04:01:49 Previewing inline node:
| EMPLOYEE_ID | NAME | SALARY | HIRE_DATE |
| ----------- | -------- | ------ | ---------- |
| 1 | Person 1 | 80000 | 2021-01-01 |
| 2 | Person 2 | 110000 | 2022-01-01 |
| 3 | Person 3 | 120000 | 2023-01-01 |
So thought I'd try using the --quiet flag but it overshot and I got no results at all:
(dbt-prod) joel@Joel-Labes joel-sandbox % dbt --quiet show --inline "select * from ANALYTICS_DEV.dbt_jlabes.salary_data"
Would have preferred
(dbt-prod) joel@Joel-Labes joel-sandbox % dbt --quiet show --inline "select * from ANALYTICS_DEV.dbt_jlabes.salary_data"
| EMPLOYEE_ID | NAME | SALARY | HIRE_DATE |
| ----------- | -------- | ------ | ---------- |
| 1 | Person 1 | 80000 | 2021-01-01 |
| 2 | Person 2 | 110000 | 2022-01-01 |
| 3 | Person 3 | 120000 | 2023-01-01 |
but purely for aesthetic reasons, I'm not piping it anywhere (just previewing a couple of tables and wanted a cleaner screenshot)
+1 for compile without logs but with the compiled query. It would be great to run dbt compile -q -s my_model and then pipe it to my clipboard or vscode without the logs at the top.