-
Notifications
You must be signed in to change notification settings - Fork 209
Re-enable ClickHouse in CLI tests #2095
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Re-enable ClickHouse in CLI tests #2095
Conversation
Co-Authored-By: Itamar Hartstein <haritamar@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] |
📝 WalkthroughWalkthroughAdds Changes
Sequence Diagram(s)(omitted) Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
Comment |
Co-Authored-By: Itamar Hartstein <haritamar@gmail.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In @.github/workflows/test-warehouse.yml:
- Around line 107-110: The workflow currently starts the clickhouse service with
"docker compose up -d clickhouse" but doesn't wait for it to be ready; either
add a healthcheck to the clickhouse service definition (a simple CMD that runs a
clickhouse-client query or TCP check) or add a follow-up workflow step after the
"Start Clickhouse" step that polls the clickhouse service until it's ready (for
example, loop running "docker compose exec clickhouse clickhouse-client --query
'SELECT 1'" with a timeout/retry and exit non-zero on failure). Update the
service named "clickhouse" or the workflow step that runs "docker compose up -d
clickhouse" accordingly so tests only proceed once ClickHouse accepts
connections.
Co-Authored-By: Itamar Hartstein <haritamar@gmail.com>
…git-manager.devin.ai/proxy/github.com/elementary-data/elementary into ele-5219-re-enable-clickhouse-in-cli-tests
Co-Authored-By: Itamar Hartstein <haritamar@gmail.com>
…ry schema" This reverts commit 1fc1952.
Co-Authored-By: Itamar Hartstein <haritamar@gmail.com>
…lickHouse column names Co-Authored-By: Itamar Hartstein <haritamar@gmail.com>
…handle ClickHouse column names" This reverts commit 5a7efb8.
…macro" This reverts commit a3bef9c.
…git-manager.devin.ai/proxy/github.com/elementary-data/elementary into ele-5219-re-enable-clickhouse-in-cli-tests
Co-Authored-By: Itamar Hartstein <haritamar@gmail.com>
…d detection Co-Authored-By: Itamar Hartstein <haritamar@gmail.com>
Co-Authored-By: Itamar Hartstein <haritamar@gmail.com>
ClickHouse returns columns with table prefix (e.g., 'failed_tests.database_name' instead of 'database_name'). Use .get() with fallbacks to handle both naming conventions for the affected fields: - database_name - schema_name - tags - test_params - severity - status - result_rows Co-Authored-By: Itamar Hartstein <haritamar@gmail.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In `@elementary/monitor/dbt_project/macros/alerts/population/test_alerts.sql`:
- Around line 9-10: The fallback key used when setting test_type is incorrect:
update the raw_test_alert.get call in the test_type assignment (the line that
sets test_type via raw_test_alert.get('alert_type',
raw_test_alert.get('failed_tests.test_type'))) to use the actual output column
name produced by the query (failed_tests.alert_type) or simply 'alert_type' as
the fallback; modify the raw_test_alert.get fallback to
raw_test_alert.get('failed_tests.alert_type') so the lookup matches the aliased
column emitted by the query where failed_tests.test_type is aliased as
alert_type.
🧹 Nitpick comments (1)
elementary/monitor/dbt_project/macros/alerts/population/test_alerts.sql (1)
17-51: Consider documenting or unifying the field access pattern.The comment on line 17 is helpful, but the selective application of
.get()fallbacks raises questions. Somefailed_testscolumns use fallbacks (database_name, schema_name, tags, test_params, severity) while others use direct access (alert_id, table_name, column_name, test_name, etc.).If this distinction is based on observed ClickHouse behavior during testing, consider expanding the comment to explain why only these specific columns need fallbacks. This will help future maintainers understand when to add fallbacks for new fields.
| {% set test_type = raw_test_alert.get('alert_type', raw_test_alert.get('failed_tests.test_type')) %} | ||
| {% set status = raw_test_alert.get('status', raw_test_alert.get('failed_tests.status')) | lower %} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Incorrect fallback key on line 9.
Looking at the SQL query, test_type is aliased to alert_type on line 149:
failed_tests.test_type as alert_type,The fallback key 'failed_tests.test_type' will never match since the output column is named alert_type, not test_type. If ClickHouse were to prefix this column, it would be failed_tests.alert_type, not failed_tests.test_type.
Proposed fix
- {% set test_type = raw_test_alert.get('alert_type', raw_test_alert.get('failed_tests.test_type')) %}
+ {% set test_type = raw_test_alert.get('alert_type', raw_test_alert.get('failed_tests.alert_type')) %}🤖 Prompt for AI Agents
In `@elementary/monitor/dbt_project/macros/alerts/population/test_alerts.sql`
around lines 9 - 10, The fallback key used when setting test_type is incorrect:
update the raw_test_alert.get call in the test_type assignment (the line that
sets test_type via raw_test_alert.get('alert_type',
raw_test_alert.get('failed_tests.test_type'))) to use the actual output column
name produced by the query (failed_tests.alert_type) or simply 'alert_type' as
the fallback; modify the raw_test_alert.get fallback to
raw_test_alert.get('failed_tests.alert_type') so the lookup matches the aliased
column emitted by the query where failed_tests.test_type is aliased as
alert_type.
ClickHouse returns columns with table prefix when column names are ambiguous across joined tables. The affected columns (database_name, schema_name, tags, test_params, severity, status, result_rows) exist in both failed_tests and tests tables. Fix: Add explicit 'as column_name' aliases in the SQL query to force ClickHouse to use the alias name instead of the qualified column name. This is cleaner than using .get() fallbacks in the macro. Co-Authored-By: Itamar Hartstein <haritamar@gmail.com>
Co-Authored-By: Itamar Hartstein <haritamar@gmail.com>
Summary
Re-enables ClickHouse testing in the CLI test workflows. This was previously disabled and the changes include:
test-warehouse.ymlclickhouseto theworkflow_dispatchoptions intest-warehouse.ymlclickhouseto the warehouse-type matrix intest-all-warehouses.ymlclickhouseto the "Seed e2e dbt project" step condition (since ClickHouse runs in Docker like Postgres)Updates since last revision
Fixed a "Object of type Undefined is not JSON serializable" error in the
populate_test_alertsmacro that was causing the "Run monitor" step to fail for ClickHouse.Root cause: ClickHouse returns columns with table prefixes (e.g.,
failed_tests.database_nameinstead ofdatabase_name) when column names are ambiguous across joined tables. The affected columns (database_name,schema_name,tags,test_params,severity,status,result_rows) exist in both thefailed_testsCTE and theteststable (fromdbt_tests).Fix: Added explicit
as column_namealiases in the SQL query for the ambiguous columns. This forces ClickHouse to use the alias name instead of the qualified column name.Review & Testing Checklist for Human
test_alerts.sqldon't break other warehouses - CI shows postgres, bigquery, and databricks_catalog passed, but please verify the query behavior is unchangedRecommended Test Plan
test_alerts.sql- the aliases are redundant for most warehouses but necessary for ClickHouseNotes
Linear ticket: ELE-5219
Link to Devin run: https://app.devin.ai/sessions/b483336a95be422d95bfcafbdf1cbb51
Requested by: Itamar Hartstein (@haritamar)
Summary by CodeRabbit
New Features
Tests
Chores
Bug Fixes
✏️ Tip: You can customize this high-level summary in your review settings.