Skip to content

Commit 99ca1fb

Browse files
max-ostapenkoGCP Dataform
authored andcommitted
testing standard reports
1 parent c897b6a commit 99ca1fb

File tree

3 files changed

+16
-12
lines changed

3 files changed

+16
-12
lines changed

definitions/output/reports/reports_dynamic.js

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@ const EXPORT_CONFIG = {
3030
// Date range for report generation
3131
// Adjust these dates to update reports retrospectively
3232
const DATE_RANGE = {
33-
startDate: constants.currentMonth, // '2025-07-01'
34-
endDate: constants.currentMonth // '2025-07-01'
33+
startDate: '2026-01-01', // constants.currentMonth, // '2026-01-01' //todo reset dates
34+
endDate: '2026-01-01' // constants.currentMonth // '2026-01-01'
3535
}
3636

3737
/**
@@ -107,9 +107,7 @@ function buildExportQuery(reportConfig) {
107107
*/
108108
function createReportConfig(date, metric, sql, lensName, lensSQL) {
109109
let tableName
110-
if (sql.type === 'timeseries') {
111-
tableName = sql.type
112-
} else if (sql.type === 'histogram') {
110+
if (sql.type === 'timeseries' || sql.type === 'histogram') {
113111
tableName = `${metric.id}_${sql.type}`
114112
} else {
115113
throw new Error(`Unknown SQL type: ${sql.type}`)
@@ -177,20 +175,21 @@ function generateOperationSQL(ctx, reportConfig) {
177175
return `
178176
DECLARE job_config JSON;
179177
180-
/* First report run - uncomment to create table
178+
--/* First report run - uncomment to create table
181179
CREATE TABLE IF NOT EXISTS ${EXPORT_CONFIG.dataset}.${tableName}
182180
PARTITION BY date
183181
CLUSTER BY metric, lens, client
184182
AS
185-
*/
183+
--*/
186184
187-
--/* Subsequent report run
185+
/* Subsequent report run
188186
DELETE FROM ${EXPORT_CONFIG.dataset}.${tableName}
189187
WHERE date = '${date}'
190188
AND metric = '${metric.id}'
191189
AND lens = '${lens.name}';
190+
192191
INSERT INTO ${EXPORT_CONFIG.dataset}.${tableName}
193-
--*/
192+
*/
194193
195194
SELECT
196195
client,

includes/constants.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ const [
2121
]
2222
: ['', '']
2323
const bucket = 'httparchive'
24-
const storagePath = 'reports/'
24+
const storagePath = 'reports/test/' // todo: restore path
2525

2626
module.exports = {
2727
today,

includes/reports.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,12 @@ const config = {
9999
`)
100100
}
101101
]
102-
},
102+
}
103+
}
104+
};
105+
106+
// todo: merge configs
107+
const config_backup = {
103108
ttci: {
104109
SQL: [
105110
{
@@ -2521,7 +2526,7 @@ const config = {
25212526
]
25222527
}
25232528
}
2524-
}
2529+
25252530

25262531
const lenses = {
25272532
all: '',

0 commit comments

Comments
 (0)