This is an automated email from the ASF dual-hosted git repository.

beto pushed a commit to branch tokenize-with-dialect
in repository https://gitbox.apache.org/repos/asf/superset.git

commit 3e66856695c0b9e04ed2e0bf1d2269a351bb213f
Author: Beto Dealmeida <[email protected]>
AuthorDate: Tue Oct 15 13:46:43 2024 -0400

    feat: use dialect when tokenizing
---
 superset/sql/parse.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/superset/sql/parse.py b/superset/sql/parse.py
index 33ed76473f..2c7276baba 100644
--- a/superset/sql/parse.py
+++ b/superset/sql/parse.py
@@ -276,7 +276,7 @@ class SQLStatement(BaseSQLStatement[exp.Expression]):
         script: str,
         engine: str,
     ) -> list[SQLStatement]:
-        if engine in SQLGLOT_DIALECTS:
+        if dialect := SQLGLOT_DIALECTS.get(engine):
             try:
                 return [
                     cls(ast.sql(), engine, ast)
@@ -297,7 +297,7 @@ class SQLStatement(BaseSQLStatement[exp.Expression]):
         remainder = script
 
         try:
-            tokens = sqlglot.tokenize(script)
+            tokens = sqlglot.tokenize(script, dialect)
         except sqlglot.errors.TokenError as ex:
             raise SupersetParseError(
                 script,

Reply via email to