-
Notifications
You must be signed in to change notification settings - Fork 2.3k
New command: dbt show #7208
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
New command: dbt show #7208
Changes from 16 commits
e6dcca4
f0ad043
eab733f
d726061
bc09cd7
f28af9c
2bcb790
e0db983
45a7f1a
3133d22
09bec45
e845b37
ea6b2b0
f25b44b
2ff263d
b3cc37d
9a6baa9
3f36494
f885193
aac83b5
ac008e0
5c96420
ffc66bd
e20af84
0bec7c4
310ddf3
05fcd34
b576018
c5d4f11
b1f29c1
06fd124
4309fac
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| kind: Features | ||
| body: 'New command: dbt show' | ||
| time: 2023-03-24T12:36:21.173419-07:00 | ||
| custom: | ||
| Author: aranke | ||
| Issue: 7207 7179 6359 |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1643,17 +1643,6 @@ message ConcurrencyLineMsg { | |
| ConcurrencyLine data = 2; | ||
| } | ||
|
|
||
| // Q028 | ||
| message CompiledNode { | ||
| string node_name = 1; | ||
| string compiled = 2; | ||
| } | ||
|
|
||
| message CompiledNodeMsg { | ||
| EventInfo info = 1; | ||
| CompiledNode data = 2; | ||
| } | ||
|
|
||
| // Q029 | ||
| message WritingInjectedSQLForNode { | ||
| NodeInfo node_info = 1; | ||
|
|
@@ -1781,6 +1770,32 @@ message CommandCompletedMsg { | |
| CommandCompleted data = 2; | ||
| } | ||
|
|
||
| // Q041 | ||
| message ShowNode { | ||
| string node_name = 1; | ||
| string preview = 2; | ||
| bool is_inline = 3; | ||
| string output_format = 4; | ||
| } | ||
|
|
||
| message ShowNodeMsg { | ||
| EventInfo info = 1; | ||
| ShowNode data = 2; | ||
| } | ||
|
|
||
| // Q042 | ||
| message CompiledNode { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why are we recreating as a new event type (with a new code)? The additional fields aren't a breaking change, right?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. They're not, I just ran out of space in the numbering and wanted to move them to the right spot before shipping. |
||
| string node_name = 1; | ||
| string compiled = 2; | ||
| bool is_inline = 3; | ||
| string output_format = 4; | ||
| } | ||
|
|
||
| message CompiledNodeMsg { | ||
| EventInfo info = 1; | ||
| CompiledNode data = 2; | ||
| } | ||
|
|
||
| // W - Node testing | ||
|
|
||
| // Skipped W001 | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,5 @@ | ||
| import json | ||
|
|
||
| from dbt.ui import line_wrap_message, warning_tag, red, green, yellow | ||
| from dbt.constants import MAXIMUM_SEED_SIZE_NAME, PIN_PACKAGE_URL | ||
| from dbt.events.base_types import ( | ||
|
|
@@ -1605,14 +1607,6 @@ def message(self) -> str: | |
| return f"Concurrency: {self.num_threads} threads (target='{self.target_name}')" | ||
|
|
||
|
|
||
| class CompiledNode(InfoLevel): | ||
| def code(self): | ||
| return "Q028" | ||
|
|
||
| def message(self) -> str: | ||
| return f"Compiled node '{self.node_name}' is:\n{self.compiled}" | ||
|
|
||
|
|
||
| class WritingInjectedSQLForNode(DebugLevel): | ||
| def code(self): | ||
| return "Q029" | ||
|
|
@@ -1719,6 +1713,42 @@ def message(self) -> str: | |
| return f"Command `{self.command}` {status} at {self.completed_at} after {self.elapsed:0.2f} seconds" | ||
|
|
||
|
|
||
| class ShowNode(InfoLevel): | ||
| def code(self): | ||
| return "Q041" | ||
|
|
||
| def message(self) -> str: | ||
| if self.output_format == "json": | ||
| if self.is_inline: | ||
| return json.dumps({"show": json.loads(self.preview)}, indent=2) | ||
| else: | ||
| return json.dumps( | ||
| {"node": self.node_name, "show": json.loads(self.preview)}, indent=2 | ||
| ) | ||
| else: | ||
| if self.is_inline: | ||
| return f"Previewing inline node:\n{self.preview}" | ||
| else: | ||
| return f"Previewing node '{self.node_name}':\n{self.preview}" | ||
|
|
||
|
|
||
| class CompiledNode(InfoLevel): | ||
| def code(self): | ||
| return "Q042" | ||
|
|
||
| def message(self) -> str: | ||
| if self.output_format == "json": | ||
| if self.is_inline: | ||
| return json.dumps({"compiled": self.compiled}, indent=2) | ||
| else: | ||
| return json.dumps({"node": self.node_name, "compiled": self.compiled}, indent=2) | ||
|
Comment on lines
+1740
to
+1744
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [Not blocking] It makes sense to me that we'd want to support similar arguments for both I don't have a very strong feeling about what to show here. The most important use case for JSON-formatted output is programmatic consumers of the
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Good catch! |
||
| else: | ||
| if self.is_inline: | ||
| return f"Compiled inline node is:\n{self.compiled}" | ||
| else: | ||
| return f"Compiled node '{self.node_name}' is:\n{self.compiled}" | ||
|
|
||
|
|
||
| # ======================================================= | ||
| # W - Node testing | ||
| # ======================================================= | ||
|
|
||
Large diffs are not rendered by default.
Uh oh!
There was an error while loading. Please reload this page.