Skip to content

adding dot option to compile command#2116

Open
AmmanuelT wants to merge 4 commits intodataform-co:mainfrom
AmmanuelT:add_dot_compile_option
Open

adding dot option to compile command#2116
AmmanuelT wants to merge 4 commits intodataform-co:mainfrom
AmmanuelT:add_dot_compile_option

Conversation

@AmmanuelT
Copy link

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

@AmmanuelT AmmanuelT requested a review from a team as a code owner March 17, 2026 12:17
@AmmanuelT AmmanuelT requested review from udim and removed request for a team March 17, 2026 12:17
@google-cla
Copy link

google-cla bot commented Mar 17, 2026

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.

@kolina
Copy link
Contributor

kolina commented Mar 17, 2026

/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) {
Copy link
Contributor

Choose a reason for hiding this comment

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

I'd create enum for output type for a compiled graph

Copy link
Author

Choose a reason for hiding this comment

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

That definitely makes more sense, working on it!

Copy link
Author

Choose a reason for hiding this comment

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

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 {
Copy link
Contributor

Choose a reason for hiding this comment

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

can you attach an image example of how it looks like?

Copy link
Author

Choose a reason for hiding this comment

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

Here is the terminal output:
terminal
Here is what it looks like rendered(Using a vscode previewer):
preview
I am having problems with formatting when piping to a file though, any thoughts on how to fix that?:
direct-pipe

Copy link
Contributor

Choose a reason for hiding this comment

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

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

Copy link
Author

Choose a reason for hiding this comment

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

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:
Screenshot 2026-03-21 at 8 31 53 AM
terminal:
Screenshot 2026-03-21 at 8 32 28 AM

cli/console.ts Outdated
return calloutOutput(`${target.schema}.${target.name}`);
}

export function dotRepresentation(graph: dataform.ICompiledGraph): string {
Copy link
Contributor

Choose a reason for hiding this comment

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

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

@AmmanuelT
Copy link
Author

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"}'
or explicit flags:
--dot-table-shape box
--dot-assertion-shape ellipse
--dot-operation-shape diamond

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Feature Request - Dependency Chain Export

2 participants