MCPcopy Create free account
hub / github.com/dataform-co/dataform / printCompiledGraph

Function printCompiledGraph

cli/console.ts:190–238  ·  view source on GitHub ↗
(graph: dataform.ICompiledGraph, outputType: compiledGraphOutputType, quietCompilation: boolean)

Source from the content-addressed store, hash-verified

188}
189
190export function printCompiledGraph(graph: dataform.ICompiledGraph, outputType: compiledGraphOutputType, quietCompilation: boolean) {
191
192 const interactive = isInteractive();
193
194 if (outputType === compiledGraphOutputType.Json) {
195 writeStdOut(prettyJsonStringify(graph));
196 } else if (outputType === compiledGraphOutputType.Dot) {
197 writeStdOut(dotRepresentation(graph, interactive));
198 } else {
199 const actionCount =
200 0 +
201 (graph.tables ? graph.tables.length : 0) +
202 (graph.assertions ? graph.assertions.length : 0) +
203 (graph.operations ? graph.operations.length : 0);
204 writeStdOut(successOutput(`Compiled ${actionCount} action(s).`));
205 if (graph.tables && graph.tables.length) {
206 graph.tables.forEach(setOrValidateTableEnumType);
207 writeStdOut(`${graph.tables.length} dataset(s)${quietCompilation ? "." : ":"}`);
208 if(!quietCompilation){
209 graph.tables.forEach(compiledTable => {
210 writeStdOut(
211 `${datasetString(
212 compiledTable.target,
213 tableTypeEnumToString(compiledTable.enumType),
214 compiledTable.disabled
215 )}`,
216 1
217 );
218 });
219 }
220 }
221 if (graph.assertions && graph.assertions.length) {
222 writeStdOut(`${graph.assertions.length} assertion(s)${quietCompilation ? "." : ":"}`);
223 if(!quietCompilation){
224 graph.assertions.forEach(assertion => {
225 writeStdOut(assertionString(assertion.target, assertion.disabled), 1);
226 });
227 }
228 }
229 if (graph.operations && graph.operations.length) {
230 writeStdOut(`${graph.operations.length} operation(s)${quietCompilation ? "." : ":"}`);
231 if(!quietCompilation){
232 graph.operations.forEach(operation => {
233 writeStdOut(operationString(operation.target, operation.disabled), 1);
234 });
235 }
236 }
237 }
238}
239
240function formatStackTraceForQuietCompilation(compileError: dataform.ICompilationError): string {
241 // Show only first 3 or available lines for cleaner error output

Callers 1

compileAndPrintFunction · 0.90

Calls 9

prettyJsonStringifyFunction · 0.90
tableTypeEnumToStringFunction · 0.90
isInteractiveFunction · 0.85
writeStdOutFunction · 0.85
dotRepresentationFunction · 0.85
successOutputFunction · 0.85
datasetStringFunction · 0.85
assertionStringFunction · 0.85
operationStringFunction · 0.85

Tested by

no test coverage detected