diff --git a/packages/cubejs-schema-compiler/src/compiler/YamlCompiler.ts b/packages/cubejs-schema-compiler/src/compiler/YamlCompiler.ts index bfcaab5d0cd28..ab910f1440e84 100644 --- a/packages/cubejs-schema-compiler/src/compiler/YamlCompiler.ts +++ b/packages/cubejs-schema-compiler/src/compiler/YamlCompiler.ts @@ -53,6 +53,16 @@ export class YamlCompiler { }); } + public async renderTemplate(file: FileContent, compileContext, pythonContext: PythonCtx): Promise { + return { + fileName: file.fileName, + content: await this.getJinjaEngine().renderTemplate(file.fileName, compileContext, { + ...pythonContext.functions, + ...pythonContext.variables + }), + }; + } + public async compileYamlWithJinjaFile( file: FileContent, errorsReport: ErrorReporter, @@ -63,15 +73,9 @@ export class YamlCompiler { toCompile, compiledFiles, compileContext, - pythonContext + pythonContext: PythonCtx ) { - const compiledFile = { - fileName: file.fileName, - content: await this.getJinjaEngine().renderTemplate(file.fileName, compileContext, { - ...pythonContext.functions, - ...pythonContext.variables - }), - }; + const compiledFile = await this.renderTemplate(file, compileContext, pythonContext); return this.compileYamlFile( compiledFile,