Skip to content
Permalink

Comparing changes

This is a direct comparison between two commits made in this repository or its related repositories. View the default comparison for this range or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: trinodb/trino-python-client
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 5d596106cc4323b305005455dc44c451a77b3489
Choose a base ref
..
head repository: trinodb/trino-python-client
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 4447b2e5fff7d275e504d6c35647d1dba968448b
Choose a head ref
Showing with 4 additions and 4 deletions.
  1. +1 −1 trino/client.py
  2. +3 −3 trino/sqlalchemy/dialect.py
2 changes: 1 addition & 1 deletion trino/client.py
Original file line number Diff line number Diff line change
@@ -721,7 +721,7 @@ def __init__(
self._request = request
self._update_type = None
self._sql = sql
self._result = TrinoResult(self, experimental_python_types=experimental_python_types)
self._result: Optional[TrinoResult] = None
self._response_headers = None
self._experimental_python_types = experimental_python_types

6 changes: 3 additions & 3 deletions trino/sqlalchemy/dialect.py
Original file line number Diff line number Diff line change
@@ -231,7 +231,7 @@ def get_view_definition(self, connection: Connection, view_name: str, schema: st
"""
).strip()
res = connection.execute(sql.text(query), schema=schema, view=view_name)
return res.scalar()
return res.scalar_one_or_none()

def get_indexes(self, connection: Connection, table_name: str, schema: str = None, **kw) -> List[Dict[str, Any]]:
if not self.has_table(connection, table_name, schema):
@@ -282,7 +282,7 @@ def get_table_comment(self, connection: Connection, table_name: str, schema: str
sql.text(query),
catalog_name=catalog_name, schema_name=schema_name, table_name=table_name
)
return dict(text=res.scalar())
return dict(text=res.scalar_one_or_none())
except error.TrinoQueryError as e:
if e.error_name in (
error.PERMISSION_DENIED,
@@ -324,7 +324,7 @@ def _get_server_version_info(self, connection: Connection) -> Any:
query = "SELECT version()"
try:
res = connection.execute(sql.text(query))
version = res.scalar()
version = res.scalar_one()
return tuple([version])
except exc.ProgrammingError as e:
logger.debug(f"Failed to get server version: {e.orig.message}")