-
Notifications
You must be signed in to change notification settings - Fork 121
Add missing query_text column to dbt_tests table #875
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
Conversation
- Added query_text column to dbt_tests table schema - Updated flatten_test macro to use query_text instead of compiled_code - This ensures compatibility with Elementary internal data processing which expects query_text column in the dbt_tests artifact Fixes ELE-5137 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] |
WalkthroughReplaces compiled_code with query_text in dbt test artifacts: adds query_text to the empty table schema and maps query_text to the output of get_compiled_code(node_dict) in the flattened test metadata. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Suggested reviewers
Poem
Pre-merge checks and finishing touches✅ Passed checks (5 passed)
✨ Finishing touches🧪 Generate unit tests (beta)
Comment |
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: 0
🧹 Nitpick comments (1)
macros/edr/dbt_artifacts/upload_dbt_tests.sql (1)
181-181: Preserve legacycompiled_codefield and mitigate hash churn
- In upload_dbt_tests.sql (line 181), add a
compiled_codealias alongside the newquery_textkey or update all downstream consumers to usequery_textto avoid breakage.- Renaming the key alters the input to
get_artifact_metadata_hash, causing hash churn—either include both keys when hashing or provide a one-time migration path.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
Disabled knowledge base sources:
- Linear integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
📒 Files selected for processing (1)
macros/edr/dbt_artifacts/upload_dbt_tests.sql(2 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (14)
- GitHub Check: test (latest_official, dremio) / test
- GitHub Check: test (latest_official, trino) / test
- GitHub Check: test (fusion, redshift) / test
- GitHub Check: test (latest_official, redshift) / test
- GitHub Check: test (latest_official, snowflake) / test
- GitHub Check: test (fusion, bigquery) / test
- GitHub Check: test (latest_official, postgres) / test
- GitHub Check: test (latest_official, databricks_catalog) / test
- GitHub Check: test (latest_official, athena) / test
- GitHub Check: test (fusion, snowflake) / test
- GitHub Check: test (latest_official, bigquery) / test
- GitHub Check: test (latest_pre, postgres) / test
- GitHub Check: test (fusion, databricks_catalog) / test
- GitHub Check: test (latest_official, clickhouse) / test
🔇 Additional comments (1)
macros/edr/dbt_artifacts/upload_dbt_tests.sql (1)
38-38: Schema: query_text added (long_string) — looks good.Ordering matches the flattened dict; type aligns with other large text fields.
Please confirm:
- Existing installs add this column automatically (on_schema_change or artifact table migration path).
- Warehouses without automatic schema evolution are covered (manual/one‑time migration).
Add missing query_text column to dbt_tests table
Summary
This PR adds the missing
query_textcolumn to thedbt_teststable schema and updates theflatten_testmacro to populate it with the compiled test query.Changes made:
query_text(long_string) column to thedbt_teststable schema definitionflatten_testmacro to usequery_textinstead ofcompiled_codeas the dictionary keyContext:
The Elementary internal codebase expects a
query_textcolumn in the dbt_tests artifact data, but the dbt-data-reliability package was usingcompiled_codeinstead. This was discovered during investigation of the Elementary internal code which has logic to filter outquery_textwith comments indicating it should exist in the raw data but not in the ORM model.Review & Testing Checklist for Human
on_schema_change='sync_all_columns')query_textis actually being populated with test queries after upgrade (rundbt runand check thedbt_teststable)query_textcolumn without issuesdbt compileto verify syntax)Test Plan
dbt run --select dbt_testson a test projectdbt_teststable and verifyquery_textcolumn exists and contains compiled SQLNotes
dbt compile- full integration tests not run due to time constraintsSummary by CodeRabbit