MCPcopy
hub / github.com/marimo-team/marimo / transformOut

Method transformOut

packages/smart-cells/src/parsers/sql-parser.ts:100–117  ·  view source on GitHub ↗
(code: string, metadata: SQLMetadata)

Source from the content-addressed store, hash-verified

98 }
99
100 transformOut(code: string, metadata: SQLMetadata): FormatResult {
101 const { quotePrefix, commentLines, showOutput, engine, dataframeName } =
102 metadata;
103
104 const start = `${dataframeName} = mo.sql(\n ${quotePrefix}"""\n`;
105 const escapedCode = code.replaceAll('"""', String.raw`\"""`);
106
107 const showOutputParam = showOutput ? "" : ",\n output=False";
108 const engineParam =
109 engine === DEFAULT_ENGINE ? "" : `,\n engine=${engine}`;
110 const end = `\n """${showOutputParam}${engineParam}\n)`;
111
112 return {
113 code:
114 [...commentLines, start].join("\n") + indentOneTab(escapedCode) + end,
115 offset: start.length + 1,
116 };
117 }
118
119 isSupported(pythonCode: string): boolean {
120 if (pythonCode.trim() === "") {

Callers

nothing calls this directly

Calls 2

indentOneTabFunction · 0.70
joinMethod · 0.45

Tested by

no test coverage detected