Skip to content

fix(schema_changes): wrap exceptions.raise_compiler_error in double c… - #1048

Open
sakshipatil-hue wants to merge 1 commit into
elementary-data:masterfrom
sakshipatil-hue:patch-1
Open

fix(schema_changes): wrap exceptions.raise_compiler_error in double c…#1048
sakshipatil-hue wants to merge 1 commit into
elementary-data:masterfrom
sakshipatil-hue:patch-1

Conversation

@sakshipatil-hue

@sakshipatil-hue sakshipatil-hue commented Sep 1, 2026

Copy link
Copy Markdown

Description

Fixes an issue where exceptions.raise_compiler_error() inside get_columns_snapshot_query.sql was rendered as literal string text instead of being evaluated by Jinja when columns are missing.

Wrapping the call in double curly braces ({{ }}) ensures the compiler error triggers properly and produces a clear, helpful error message rather than a confusing SQL syntax error.

Closes #1047

Summary by CodeRabbit

  • Bug Fixes
    • Corrected error handling when no columns are detected, ensuring compilation now stops with a clear error instead of generating invalid SQL.

@github-actions

github-actions Bot commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

👋 @sakshipatil-hue
Thank you for raising your pull request.
Please make sure to add tests and document all user-facing changes.
You can do this by editing the docs files in the elementary repository.

@coderabbitai

coderabbitai Bot commented Sep 1, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Team

Run ID: e9bf1964-3318-4570-b5d9-04a4f3422bed

📥 Commits

Reviewing files that changed from the base of the PR and between 6184061 and b61d22e.

📒 Files selected for processing (1)
  • macros/edr/data_monitoring/schema_changes/get_columns_snapshot_query.sql

Included review availability: Your plan provides up to 4 included reviews per hour; 3 remain after this review.


📝 Walkthrough

Walkthrough

The schema changes macro now evaluates exceptions.raise_compiler_error(no_columns_error) during dbt compilation when no columns are detected, instead of emitting the call as literal SQL text.

Changes

Schema changes compiler error

Layer / File(s) Summary
Evaluate the no-columns compiler error
macros/edr/data_monitoring/schema_changes/get_columns_snapshot_query.sql
The macro wraps exceptions.raise_compiler_error(no_columns_error) in Jinja expression delimiters so the intended compiler error is raised during compilation.

Estimated code review effort: 1 (Trivial) | ~2 minutes

Merge Risk: ⚪ Minimal · up to b61d2

This is a localized template correction that restores the intended compiler-error behavior; no actionable merge-blocking risk remains beyond normal checks and review.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly describes the primary fix: wrapping exceptions.raise_compiler_error in the schema_changes macro.
Linked Issues check ✅ Passed The change directly satisfies issue #1047 by evaluating exceptions.raise_compiler_error with Jinja delimiters, so the intended compiler error is raised when no columns are detected.
Out of Scope Changes check ✅ Passed The pull request changes only the affected no-columns guard and contains no unrelated modifications.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 0…
Full details: Docstring Coverage

Explanation

No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 0 files. (1 skipped: 1 unsupported.)

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Comment @coderabbitai help to get the list of available commands.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

schema_changes: missing {{ }} around exceptions.raise_compiler_error() emits literal Jinja text into generated SQL

1 participant