Skip to content

Chore: do not fail if sqlglot optimization rules raise an exception#5040

Closed
georgesittas wants to merge 1 commit intomainfrom
jo/more_lenient_handling_of_sqlglot_exceptions
Closed

Chore: do not fail if sqlglot optimization rules raise an exception#5040
georgesittas wants to merge 1 commit intomainfrom
jo/more_lenient_handling_of_sqlglot_exceptions

Conversation

@georgesittas
Copy link
Contributor

@georgesittas georgesittas commented Jul 28, 2025

Sometimes, rendering may fail without raising a SqlglotError, e.g., if there is a bug and one of qualify, annotate_types or simplify fail. I believe logging those errors is helpful, but failing to load altogether seems too abrupt. This PR intercepts those exceptions and logs a warning instead of re-raising them.

The tradeoff here is that we're reducing the likelyhood of seeing these errors as they happen in the wild, since they're now going to only emit a warning. I'm personally happy with this vs running to put out fires.

@georgesittas georgesittas requested review from a team, izeigerman and tobymao July 28, 2025 10:52
@georgesittas
Copy link
Contributor Author

Discussed offline– closing this because users have the option of setting optimize_query false and bypassing uncaught errors.

@georgesittas georgesittas deleted the jo/more_lenient_handling_of_sqlglot_exceptions branch July 28, 2025 21:02
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.

1 participant