adding dot option to compile command#2116
adding dot option to compile command#2116AmmanuelT wants to merge 4 commits intodataform-co:mainfrom
Conversation
|
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
|
/gcbrun |
cli/console.ts
Outdated
|
|
||
| export function printCompiledGraph(graph: dataform.ICompiledGraph, asJson: boolean, quietCompilation: boolean) { | ||
| export function printCompiledGraph(graph: dataform.ICompiledGraph, asJson: boolean, asDot: boolean, quietCompilation: boolean) { | ||
| if (asJson) { |
There was a problem hiding this comment.
I'd create enum for output type for a compiled graph
There was a problem hiding this comment.
That definitely makes more sense, working on it!
There was a problem hiding this comment.
This is implemented, added an output type enum
cli/console.ts
Outdated
| return calloutOutput(`${target.schema}.${target.name}`); | ||
| } | ||
|
|
||
| export function dotRepresentation(graph: dataform.ICompiledGraph): string { |
There was a problem hiding this comment.
can you attach an image example of how it looks like?
There was a problem hiding this comment.
I think our current logic doesn't detect when output file descriptor is non-interactive to disable ANSI color codes
You can try updating it: see this logic as example
There was a problem hiding this comment.
This is so helpful! The output now has the ANSI color codes disabled for non-interactive outputs: here's a sample using the dataform-example-project-bigquery repo.
VS code dot file and preview:

terminal:

cli/console.ts
Outdated
| return calloutOutput(`${target.schema}.${target.name}`); | ||
| } | ||
|
|
||
| export function dotRepresentation(graph: dataform.ICompiledGraph): string { |
There was a problem hiding this comment.
I think our current logic doesn't detect when output file descriptor is non-interactive to disable ANSI color codes
You can try updating it: see this logic as example
|
One follow-up question on scope for this PR: does it make sense to include DOT shape/styling options per action type here, or keep this PR focused and track that separately? I was thinking: --dot-style '{"table":"box","assertion":"ellipse","operation":"diamond"}' |



This update adds a dot option to the compile command. It formats the json as a dot string and writes it out. table types are added to the label as name [tableType]. fixes #1232