Skip to content

Commit

Permalink
Use {{DB}} in all queries
Browse files Browse the repository at this point in the history
Signed-off-by: Lorenzo Mangani <[email protected]>
  • Loading branch information
lmangani authored Oct 22, 2023
1 parent f82c3dc commit a855ba5
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions lib/db/maintain/scripts.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ module.exports.overall = [
AS SELECT date, pairs.1 as key, pairs.2 as val, fingerprint
FROM time_series ARRAY JOIN JSONExtractKeysAndValues(time_series.labels, 'String') as pairs`,

`INSERT INTO settings (fingerprint, type, name, value, inserted_at) VALUES (cityHash64('update_v3_5'), 'update',
`INSERT INTO {{DB}}.settings (fingerprint, type, name, value, inserted_at) VALUES (cityHash64('update_v3_5'), 'update',
'v3_1', toString(toUnixTimestamp(NOW())), NOW())`,

`CREATE TABLE IF NOT EXISTS {{DB}}.metrics_15s {{{OnCluster}}} (
Expand All @@ -65,10 +65,10 @@ SELECT fingerprint,
countState() as count,
sumSimpleState(value) as sum,
sumSimpleState(length(string)) as bytes
FROM samples_v3 as samples
FROM {{DB}}.samples_v3 as samples
GROUP BY fingerprint, timestamp_ns;`,

`INSERT INTO settings (fingerprint, type, name, value, inserted_at) VALUES (cityHash64('update_v3_2'), 'update',
`INSERT INTO {{DB}}.settings (fingerprint, type, name, value, inserted_at) VALUES (cityHash64('update_v3_2'), 'update',
'v3_2', toString(toUnixTimestamp(NOW())), NOW())`
]

Expand Down Expand Up @@ -151,7 +151,7 @@ module.exports.traces = [
duration_ns as duration
FROM traces_input ARRAY JOIN tags`,

`INSERT INTO settings (fingerprint, type, name, value, inserted_at) VALUES (cityHash64('tempo_traces_v1'), 'update',
`INSERT INTO {{DB}}.settings (fingerprint, type, name, value, inserted_at) VALUES (cityHash64('tempo_traces_v1'), 'update',
'tempo_traces_v2', toString(toUnixTimestamp(NOW())), NOW())`
]

Expand Down Expand Up @@ -198,15 +198,15 @@ module.exports.overall_dist = [
]

module.exports.traces_dist = [
`CREATE TABLE IF NOT EXISTS tempo_traces_kv_dist {{{OnCluster}}} (
`CREATE TABLE IF NOT EXISTS {{DB}}.tempo_traces_kv_dist {{{OnCluster}}} (
oid String,
date Date,
key String,
val_id String,
val String
) ENGINE = Distributed('{{CLUSTER}}','{{DB}}', 'tempo_traces_kv', sipHash64(oid, key));`,

`CREATE TABLE IF NOT EXISTS tempo_traces_dist {{{OnCluster}}} (
`CREATE TABLE IF NOT EXISTS {{DB}}.tempo_traces_dist {{{OnCluster}}} (
oid String,
trace_id FixedString(16),
span_id FixedString(8),
Expand All @@ -219,7 +219,7 @@ module.exports.traces_dist = [
payload String,
) ENGINE = Distributed('{{CLUSTER}}','{{DB}}', 'tempo_traces', sipHash64(oid, trace_id));`,

`CREATE TABLE IF NOT EXISTS tempo_traces_attrs_gin_dist {{{OnCluster}}} (
`CREATE TABLE IF NOT EXISTS {{DB}}.tempo_traces_attrs_gin_dist {{{OnCluster}}} (
oid String,
date Date,
key String,
Expand Down

0 comments on commit a855ba5

Please sign in to comment.