🪢 Open source agent evals & observability: Trace, evaluate, and improve LLM applications with one open platform.
TypeScript analyticsautogenevaluationlangchainlarge-language-modelsllama-indexllmllm-evaluationllm-observabilityllmopsmonitoringobservabilityopen-sourceopenaiplaygroundprompt-engineeringprompt-managementself-hostedycombinator
fix(clickhouse): avoid atomic view replacement in migration (#14951)
ofeliacode5b1d6bd7adea
diff --git a/packages/shared/clickhouse/migrations/clustered/0036_add_ingested_sdks_to_analytics_scores.down.sql b/packages/shared/clickhouse/migrations/clustered/0036_add_ingested_sdks_to_analytics_scores.down.sqlindex 2b4bca7dd4..8f5c9219e2 100644--- a/packages/shared/clickhouse/migrations/clustered/0036_add_ingested_sdks_to_analytics_scores.down.sql+++ b/packages/shared/clickhouse/migrations/clustered/0036_add_ingested_sdks_to_analytics_scores.down.sql@@ -1,4 +1,5 @@-CREATE OR REPLACE VIEW analytics_scores ON CLUSTER default AS+DROP VIEW IF EXISTS analytics_scores ON CLUSTER default;+CREATE VIEW analytics_scores ON CLUSTER default ASSELECTproject_id,toStartOfHour(timestamp) AS hour,diff --git a/packages/shared/clickhouse/migrations/clustered/0036_add_ingested_sdks_to_analytics_scores.up.sql b/packages/shared/clickhouse/migrations/clustered/0036_add_ingested_sdks_to_analytics_scores.up.sqlindex 5094fa45cc..2caf436211 100644--- a/packages/shared/clickhouse/migrations/clustered/0036_add_ingested_sdks_to_analytics_scores.up.sql+++ b/packages/shared/clickhouse/migrations/clustered/0036_add_ingested_sdks_to_analytics_scores.up.sql@@ -1,4 +1,5 @@-CREATE OR REPLACE VIEW analytics_scores ON CLUSTER default AS+DROP VIEW IF EXISTS analytics_scores ON CLUSTER default;+CREATE VIEW analytics_scores ON CLUSTER default ASSELECTproject_id,toStartOfHour(timestamp) AS hour,diff --git a/packages/shared/clickhouse/migrations/unclustered/0036_add_ingested_sdks_to_analytics_scores.down.sql b/packages/shared/clickhouse/migrations/unclustered/0036_add_ingested_sdks_to_analytics_scores.down.sqlindex db9ea4c0d1..1c9aa7f16f 100644--- a/packages/shared/clickhouse/migrations/unclustered/0036_add_ingested_sdks_to_analytics_scores.down.sql+++ b/packages/shared/clickhouse/migrations/unclustered/0036_add_ingested_sdks_to_analytics_scores.down.sql@@ -1,4 +1,5 @@-CREATE OR REPLACE VIEW analytics_scores AS+DROP VIEW IF EXISTS analytics_scores;+CREATE VIEW analytics_scores ASSELECTproject_id,toStartOfHour(timestamp) AS hour,diff --git a/packages/shared/clickhouse/migrations/unclustered/0036_add_ingested_sdks_to_analytics_scores.up.sql b/packages/shared/clickhouse/migrations/unclustered/0036_add_ingested_sdks_to_analytics_scores.up.sqlindex a469bd9c35..4cf20e3eb6 100644--- a/packages/shared/clickhouse/migrations/unclustered/0036_add_ingested_sdks_to_analytics_scores.up.sql+++ b/packages/shared/clickhouse/migrations/unclustered/0036_add_ingested_sdks_to_analytics_scores.up.sql@@ -1,4 +1,5 @@-CREATE OR REPLACE VIEW analytics_scores AS+DROP VIEW IF EXISTS analytics_scores;+CREATE VIEW analytics_scores ASSELECTproject_id,toStartOfHour(timestamp) AS hour,diff --git a/packages/shared/clickhouse/scripts/dev-tables.sh b/packages/shared/clickhouse/scripts/dev-tables.shindex 94b72d42a5..f0911667b2 100644--- a/packages/shared/clickhouse/scripts/dev-tables.sh+++ b/packages/shared/clickhouse/scripts/dev-tables.sh@@ -686,10 +686,11 @@ SETTINGS enable_full_text_index = 1;-- PROD ROLLOUT: unlike analytics_scores (managed via numbered migrations),-- this view is NOT migration-managed because events_core only exists in-- cloud environments (see header note). Any change here must be applied--- manually as CREATE OR REPLACE VIEW in every cloud region (eu, us, hipaa,--- jp) and recorded in the migrations doc linked in the header — otherwise--- the DWH S3 export silently misses the new columns.-CREATE OR REPLACE VIEW analytics_events_core AS+-- manually as DROP VIEW IF EXISTS followed by CREATE VIEW in every cloud+-- region (eu, us, hipaa, jp) and recorded in the migrations doc linked in the+-- header — otherwise the DWH S3 export silently misses the new columns.+DROP VIEW IF EXISTS analytics_events_core;+CREATE VIEW analytics_events_core ASSELECTproject_id,toStartOfHour(start_time) AS hour,