-
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
Parseable JSON and text output in quiet mode for dbt show
and dbt compile
#9958
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #9958 +/- ##
==========================================
- Coverage 89.13% 89.08% -0.06%
==========================================
Files 183 183
Lines 23638 23644 +6
==========================================
- Hits 21070 21063 -7
- Misses 2568 2581 +13
Flags with carried forward coverage won't be shown. Click here to find out more.
|
@b-per FYI this and dbt-labs/dbt-common#216 are meant to solve your request in #9840 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, large diff is because of change in proto.
dbt show
and dbt compile
to output JSON without extra logsdbt show
and dbt compile
…tty/9840-quiet-show
…/dbt-core into dbeatty/9840-quiet-show
resolves #9840 (along with dbt-labs/dbt-common#216)
Problem
As described in #9840:
dbt list
uses the--quiet
flag to isolate the desired output from the log output, allowing the results to be piped or redirected.But currently,
dbt show
anddbt compile
do not work similarly. Rather, the--quiet
flag suppresses all output.Solution
The latest solution uses dbt-labs/dbt-common#216 so that
CompiledNode
andShowNode
keep their same event names in the JSON logs, but also allow it to be emitted without timestamps even when--quiet
.When
--quiet
, also skips any extraneous output like:Previewing node 'my_model':
Previewing inline node:
Compiled node 'my_model' is:
Compiled inline node is:
🎩
Initial Solution (not adopted)
The initial solution adopted the same exact approach as
dbt list
here, and basically copy-pasted from there.Similar to how #10131 stopped using
ListCmdOut
in favor ofPrintEvent
, this PR stopped usingCompiledNode
andShowNode
in favor ofPrintEvent
.👉 So any consumers relying on
CompiledNode
orShowNode
existing with JSON logs wouldn't see those anymore but would see onlyPrintEvent
instead. So I switched to the latest solution, to avoid any unintentional breakage for anyone creating and parsing JSON logs fordbt show
/dbt compile
.Before vs. after
Scenarios:
show
vs.compile
--select
vs.--inline
--quiet
vs.--no-quiet
--output text
vs.json
--log-format text
vs.json
Example for initial solution
logs/dbt.log
before:logs/dbt.log
after:This shows a difference in the JSON messages in the logs if
CompiledNode
andShowNode
events are converted toPrintEvent
events.In contrast, the solution we decided upon keeps
CompiledNode
andShowNode
events so the logs stay the same and don't change.Checklist