One dimension whose value is a scalar column or a scalar prop.
(dim: string, value: string, where = LIFECYCLE)
| 101 | |
| 102 | /** One dimension whose value is a scalar column or a scalar prop. */ |
| 103 | function dimStatement(dim: string, value: string, where = LIFECYCLE): string { |
| 104 | return `INSERT INTO daily_dim_counts (day, event, dim, value, count, machines) |
| 105 | SELECT e.day, e.event, '${dim}', CAST(${value} AS TEXT), count(*), count(DISTINCT e.machine_id) |
| 106 | FROM events e |
| 107 | WHERE e.day = ? AND ${value} IS NOT NULL AND ${value} <> ''${where} |
| 108 | GROUP BY e.day, e.event, ${value} |
| 109 | ${DIM_CONFLICT}`; |
| 110 | } |
| 111 | |
| 112 | /** |
| 113 | * One usage dimension, from a `usage_daily` column. Absent values are stored as '' |