fix: add ClickHouse-specific UPDATE syntax for alert status updates#2090
fix: add ClickHouse-specific UPDATE syntax for alert status updates#2090
Conversation
ClickHouse does not support standard SQL UPDATE statements. Instead, it requires ALTER TABLE ... UPDATE syntax for mutations. This change adds adapter dispatch for the update_skipped_alerts and update_sent_alerts macros to use the correct ClickHouse syntax when running on ClickHouse adapters. Fixes ClickHouse syntax error (Code 62) when running 'edr monitor'. Co-Authored-By: Yosef Arbiv <yosef.arbiv@gmail.com>
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
|
👋 @devin-ai-integration[bot] |
📝 WalkthroughWalkthroughThis PR refactors two alert management macros to use adapter dispatch pattern. It replaces inline SQL query construction with delegated calls to dispatcher macros that dynamically select engine-specific implementations for updating sent and skipped alerts. Changes
Estimated Code Review Effort🎯 3 (Moderate) | ⏱️ ~20 minutes Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Comment |
Summary
Fixes ClickHouse syntax error (Code 62) when running
edr monitor. ClickHouse does not support standard SQLUPDATEstatements - it requiresALTER TABLE ... UPDATEsyntax for mutations.This PR adds adapter dispatch for the
update_skipped_alertsandupdate_sent_alertsmacros to use the correct ClickHouse syntax when running on ClickHouse adapters. The default implementation preserves existing behavior for all other adapters.Error being fixed:
Root cause: The macros were generating
UPDATE table SET ...which ClickHouse doesn't support. ClickHouse requiresALTER TABLE table UPDATE ....Review & Testing Checklist for Human
ALTER TABLE ... UPDATEsyntax should match ClickHouse documentation. I have not tested this on an actual ClickHouse instance.edr monitoron a ClickHouse setup where a model previously failed to confirm the fix works end-to-end"elementary_cli"is the correct namespace for the dispatch pattern in this contextRecommended Test Plan
edr monitorand verify it completes without the syntax erroralerts_v2tableNotes
dbt-data-reliability/macros/utils/table_operations/delete_and_insert.sqlSummary by CodeRabbit
✏️ Tip: You can customize this high-level summary in your review settings.