Skip to content

Commit 894de2c

Browse files
mdesmethashhar
authored andcommitted
Use sqlalchemy 1.3 compatible methods
1 parent f97aea6 commit 894de2c

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

trino/sqlalchemy/dialect.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,7 @@ def get_view_definition(self, connection: Connection, view_name: str, schema: st
239239
"""
240240
).strip()
241241
res = connection.execute(sql.text(query), schema=schema, view=view_name)
242-
return res.scalar_one_or_none()
242+
return res.scalar()
243243

244244
def get_indexes(self, connection: Connection, table_name: str, schema: str = None, **kw) -> List[Dict[str, Any]]:
245245
if not self.has_table(connection, table_name, schema):
@@ -292,7 +292,7 @@ def get_table_comment(self, connection: Connection, table_name: str, schema: str
292292
sql.text(query),
293293
catalog_name=catalog_name, schema_name=schema_name, table_name=table_name
294294
)
295-
return dict(text=res.scalar_one_or_none())
295+
return dict(text=res.scalar())
296296
except error.TrinoQueryError as e:
297297
if e.error_name in (
298298
error.PERMISSION_DENIED,
@@ -334,7 +334,7 @@ def _get_server_version_info(self, connection: Connection) -> Any:
334334
query = "SELECT version()"
335335
try:
336336
res = connection.execute(sql.text(query))
337-
version = res.scalar_one()
337+
version = res.scalar()
338338
return tuple([version])
339339
except exc.ProgrammingError as e:
340340
logger.debug(f"Failed to get server version: {e.orig.message}")

0 commit comments

Comments
 (0)