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

Add ShowNode and CompiledNode to PrintEvent as special case, quiet-compatible events #216

Merged
merged 4 commits into from
Nov 19, 2024

Conversation

dbeatty10
Copy link
Contributor

@dbeatty10 dbeatty10 commented Nov 5, 2024

for dbt-labs/dbt-core#9840 (along with dbt-labs/dbt-core#9958)

Problem

dbt --quiet show ... doesn't print anything to stdout.

There are users that would like:

  • the output of dbt show to be valid JSON containing just the data and no logs.
  • the output of dbt compile to be valid SQL without any logs.

It would make sense for --quiet to suppress the logs but allow the main content to pass through. But instead, it suppresses all logging for dbt show and dbt compile.

Solution

For the --quiet CLI (or DBT_QUIET environment variable), allow the main content to pass through for dbt show and dbt compile. But still suppress the rest of the logs.

Extending the work in #130 to apply to the ShowNode and CompiledNode events accomplishes this.

🎩

$ dbt show -s show_me --output json --quiet

{
  "node": "show_me",
  "show": [
    {
      "jerry_maguire": "Show me the JSON!"
    }
  ]
}
$ dbt compile -s show_me --output json --quiet

{
  "node": "show_me",
  "compiled": "select 'Show me the JSON!' as jerry_maguire"
}
$ dbt show -s show_me --quiet

Previewing node 'show_me':
| jerry_maguire     |
| ----------------- |
| Show me the JSON! |
$ dbt compile -s show_me --quiet

Compiled node 'show_me' is:
select 'Show me the JSON!' as jerry_maguire

Note

Once dbt-labs/dbt-core#9958 is implemented, the "Previewing node 'show_me':" and "Compiled node 'show_me' is:" portions will be dropped.

Checklist

@cla-bot cla-bot bot added the cla:yes label Nov 5, 2024
Copy link

github-actions bot commented Nov 5, 2024

Thank you for your pull request! We could not find a changelog entry for this change. For details on how to document a change, see the contributing guide.

@codecov-commenter
Copy link

codecov-commenter commented Nov 5, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 68.48%. Comparing base (5a401a9) to head (080cc9a).
Report is 3 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #216   +/-   ##
=======================================
  Coverage   68.48%   68.48%           
=======================================
  Files          52       52           
  Lines        3389     3389           
=======================================
  Hits         2321     2321           
  Misses       1068     1068           
Flag Coverage Δ
unit 68.48% <100.00%> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.


🚨 Try these New Features:

@dbeatty10 dbeatty10 marked this pull request as ready for review November 5, 2024 17:35
@dbeatty10 dbeatty10 requested a review from a team as a code owner November 5, 2024 17:35
Copy link
Member

@aranke aranke left a comment

Choose a reason for hiding this comment

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

LGTM!

@dbeatty10 dbeatty10 changed the title Add ShowNode and CompiledNode to PrintEvent as special case, quiet-compatible events Add ShowNode and CompiledNode to PrintEvent as special case, quiet-compatible events Nov 11, 2024
@dbeatty10 dbeatty10 added this pull request to the merge queue Nov 19, 2024
Merged via the queue into main with commit 9bd1064 Nov 19, 2024
15 checks passed
@dbeatty10 dbeatty10 deleted the dbeatty/9840-quiet-show branch November 19, 2024 02:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants