diff --git a/superset/sql/parse.py b/superset/sql/parse.py index c750e0551b0..af72f72e952 100644 --- a/superset/sql/parse.py +++ b/superset/sql/parse.py @@ -58,7 +58,7 @@ logger = logging.getLogger(__name__) SQLGLOT_DIALECTS = { "base": Dialects.DIALECT, "ascend": Dialects.HIVE, - "awsathena": Dialects.PRESTO, + "awsathena": Dialects.ATHENA, "bigquery": Dialects.BIGQUERY, "clickhouse": Dialects.CLICKHOUSE, "clickhousedb": Dialects.CLICKHOUSE, diff --git a/tests/unit_tests/sql/parse_tests.py b/tests/unit_tests/sql/parse_tests.py index 95d1f364193..f8e7251d808 100644 --- a/tests/unit_tests/sql/parse_tests.py +++ b/tests/unit_tests/sql/parse_tests.py @@ -2891,6 +2891,20 @@ def test_singlestore_engine_mapping(): assert "COUNT(*)" in formatted +def test_awsathena_engine_mapping(): + """ + Test the `awsathena` dialect is properly mapped to ATHENA instead of PRESTO. + """ + sql = ( + "USING EXTERNAL FUNCTION my_func(x INT) RETURNS INT LAMBDA 'lambda_name' " + "SELECT my_func(id) FROM my_table" + ) + statement = SQLStatement(sql, engine="awsathena") + + # Should parse without errors using Athena dialect + statement.format() + + def test_remove_quotes() -> None: """ Test the `remove_quotes` helper function.