Files
superset2/superset/sql/dialects/__init__.py
Evan 9982dbaf83 fix(trino): support inline SQL UDFs (WITH FUNCTION ... BEGIN ... END)
sqlglot cannot parse Trino SQL routine syntax, so queries declaring
inline UDFs failed to parse in SQL Lab: the parser splits statements
on every semicolon (including the ones inside BEGIN ... END routine
bodies) and has no grammar for FUNCTION specifications in a WITH
clause. The upstream issue (tobymao/sqlglot#5178) was closed as low
priority, so this extends the Trino dialect on the Superset side.

The custom dialect keeps routine bodies intact when splitting
statements and parses inline function specifications into opaque
InlineUDF nodes that regenerate verbatim. Trino does not allow queries
inside SQL UDF bodies, so the opaque representation hides no table
references from Superset's security checks. The extensions only
activate on syntax that fails to parse today, so existing queries are
unaffected.

Fixes #26162

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-06 11:22:45 -07:00

36 lines
1.1 KiB
Python

# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
from .db2 import DB2
from .dremio import Dremio
from .firebolt import Firebolt, FireboltOld
from .opensearch import OpenSearch
from .pinot import Pinot
from .trino import Trino
from .vertica import Vertica
__all__ = [
"DB2",
"Dremio",
"Firebolt",
"FireboltOld",
"OpenSearch",
"Pinot",
"Trino",
"Vertica",
]