Skip to content

Commit b1d13a8

Browse files
committed
Fix 'TableClause' object has no attribute 'dialect_options'
1 parent cd614ff commit b1d13a8

File tree

1 file changed

+3
-12
lines changed

1 file changed

+3
-12
lines changed

trino/sqlalchemy/compiler.py

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -10,17 +10,8 @@
1010
# See the License for the specific language governing permissions and
1111
# limitations under the License.
1212
from sqlalchemy.sql import compiler
13-
try:
14-
from sqlalchemy.sql.expression import (
15-
Alias,
16-
CTE,
17-
Subquery,
18-
)
19-
except ImportError:
20-
# For SQLAlchemy versions < 1.4, the CTE and Subquery classes did not explicitly exist
21-
from sqlalchemy.sql.expression import Alias
22-
CTE = type(None)
23-
Subquery = type(None)
13+
from sqlalchemy.sql.base import DialectKWArgs
14+
2415

2516
# https://trino.io/docs/current/language/reserved.html
2617
RESERVED_WORDS = {
@@ -125,7 +116,7 @@ def add_catalog(sql, table):
125116
if table is None:
126117
return sql
127118

128-
if isinstance(table, (Alias, CTE, Subquery)):
119+
if not isinstance(table, DialectKWArgs):
129120
return sql
130121

131122
if (

0 commit comments

Comments
 (0)