Hi there,
I have an question is the extension of this topic. Hope you’ll be able to answer. Which one has faster compute and not occupy storage? They both can be manual execution. Thank you in advance.
Is using definitions/backfill_batch.js (i can’t use resolve(“master”) )
// definitions/file.js
//operate("an-operation", ["SELECT 1", "SELECT 2"])
var sourceTable = "`analytics-pipeline.source.master`";
var dailyArticlePerformance = "`analytics-pipeline.reporting.daily_article_performance`";
//pipeline_queries.js contains all pipeline queries
var insertselectStatement = pipeline_queries.insertQuery + dailyArticlePerformance
+ pipeline_queries.select_daily_article_performance;
var whereCondition = pipeline_queries.wherePart1_daily_article_performance
+ pipeline_queries.wherePart2_daily_article_performance_batchBackfilling;
var groupByStatement = pipeline_queries.groupBy_daily_article_performance;
operate(`backfill `,`${script_builder.render_script(sourceTable, insertselectStatement, whereCondition, groupByStatement)}`);
or using definitions/operation_backfilling_batch.sqlx
config {
type: "operations",
schema:"reporting",
hasOutput: true,
}
${script_builder.render_script(
resolve("master"),
pipeline_queries.insertQuery + resolve("daily_article_performance")
+ pipeline_queries.select_daily_article_performance,
pipeline_queries.wherePart1_daily_article_performance
+ pipeline_queries.wherePart2_daily_article_performance_batchBackfilling,
pipeline_queries.groupBy_daily_article_performance)}
includes/script_builder.js
//render_script returns a query
function render_script(fromTable, selectStatement, whereConditions, groupByStatement) {
return `${selectStatement}
FROM ${fromTable}
${whereConditions}
${groupByStatement}
`;
}
module.exports = {
render_script,
}
const insertQuery = 'insert into ';
...
module.exports = {
insertQuery,
select_daily_article_performance,
wherePart1_daily_article_performance,
wherePart2_daily_article_performance,
wherePart2_daily_article_performance_batchBackfilling,
groupBy_daily_article_performance,
};