From 76a44757f3c35045841cf2c3831524f4b501c025 Mon Sep 17 00:00:00 2001 From: Nick Crews Date: Thu, 20 Nov 2025 12:55:42 -0700 Subject: [PATCH] test: error when sqlglot tells us a compilation is unsupported --- ibis/backends/sql/__init__.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/ibis/backends/sql/__init__.py b/ibis/backends/sql/__init__.py index c3a03823cb7e..9be0f9e1bd37 100644 --- a/ibis/backends/sql/__init__.py +++ b/ibis/backends/sql/__init__.py @@ -118,7 +118,17 @@ def compile( Compiled expression """ query = self.compiler.to_sqlglot(expr, limit=limit, params=params) - sql = query.sql(dialect=self.dialect, pretty=pretty, copy=False) + try: + sql = query.sql( + dialect=self.dialect, + pretty=pretty, + copy=False, + unsupported_level=sg.ErrorLevel.RAISE, + ) + except sg.UnsupportedError as e: + raise exc.UnsupportedOperationError( + f"Operation not supported in {self.name} backend: {e}" + ) from e self._log(sql) return sql