in includes/functions.js [17:34]
function buildViewUnion(columns, system, table_prefix, lookback_days){
var output = "";
var tables = constants.settings[system];
tables.forEach( function (table_ref, index) {
var table_name = "`" + table_ref["project"] + "`." + table_ref["dataset"] + ".`" + table_prefix + table_ref["table_suffix"] + "`"
if ( index > 0 ) {
output = output.concat("\n UNION ALL\n")
}
output = output.concat(" SELECT DISTINCT\n ", columns, "\n FROM ", table_name)
if ( typeof lookback_days !== "undefined" ){
output = output.concat("\n WHERE _PARTITIONTIME > TIMESTAMP_SUB(CURRENT_TIMESTAMP(), INTERVAL ", lookback_days, " DAY) ")
}
});
return output;
}