Compare commits

...

1 Commits

Author SHA1 Message Date
Jeremy Cohen
bbedd734fb Include columns in show output 2024-02-21 20:16:00 -05:00
4 changed files with 185 additions and 176 deletions

View File

@@ -1532,6 +1532,7 @@ message ShowNode {
bool is_inline = 3;
string output_format = 4;
string unique_id = 5;
repeated string columns = 6;
}
message ShowNodeMsg {

File diff suppressed because one or more lines are too long

View File

@@ -1520,10 +1520,17 @@ class ShowNode(InfoLevel):
def message(self) -> str:
if self.output_format == "json":
if self.is_inline:
return json.dumps({"show": json.loads(self.preview)}, indent=2)
return json.dumps(
{"columns": list(self.columns), "show": json.loads(self.preview)}, indent=2
)
else:
return json.dumps(
{"node": self.node_name, "show": json.loads(self.preview)}, indent=2
{
"node": self.node_name,
"columns": list(self.columns),
"show": json.loads(self.preview),
},
indent=2,
)
else:
if self.is_inline:

View File

@@ -101,6 +101,7 @@ class ShowTask(CompileTask):
fire_event(
ShowNode(
node_name=node_name,
columns=[col.name for col in table.columns],
preview=output.getvalue(),
is_inline=is_inline,
output_format=self.args.output,