potiuk commented on code in PR #26944:
URL: https://github.com/apache/airflow/pull/26944#discussion_r1006269450
##########
airflow/providers/common/sql/hooks/sql.py:
##########
@@ -175,41 +207,26 @@ def get_pandas_df_by_chunks(self, sql, parameters=None,
*, chunksize, **kwargs):
yield from psql.read_sql(sql, con=conn, params=parameters,
chunksize=chunksize, **kwargs)
def get_records(
- self,
- sql: str | list[str],
- parameters: Iterable | Mapping | None = None,
- **kwargs: dict,
- ):
+ self, sql: str | list[str], parameters: Iterable | Mapping | None =
None
+ ) -> Any | list[Any]:
"""
Executes the sql and returns a set of records.
- :param sql: the sql statement to be executed (str) or a list of
- sql statements to execute
+ :param sql: the sql statement to be executed (str) or a list of sql
statements to execute
:param parameters: The parameters to render the SQL query with.
"""
- with closing(self.get_conn()) as conn:
- with closing(conn.cursor()) as cur:
- if parameters is not None:
- cur.execute(sql, parameters)
- else:
- cur.execute(sql)
- return cur.fetchall()
+ return self.run(sql=sql, parameters=parameters,
handler=fetch_all_handler)
- def get_first(self, sql: str | list[str], parameters=None):
+ def get_first(
+ self, sql: str | list[str], parameters: Iterable | Mapping | None =
None
+ ) -> Any | list[Any]:
Review Comment:
Same here I think `Any` should do.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]