turbaszek commented on a change in pull request #9960:
URL: https://github.com/apache/airflow/pull/9960#discussion_r487567778
##########
File path: airflow/hooks/dbapi_hook.py
##########
@@ -132,14 +133,35 @@ def get_records(self, sql, parameters=None):
:type sql: str or list
:param parameters: The parameters to render the SQL query with.
:type parameters: dict or iterable
+ :param first_only: Bool indicating whether to return full set or first
record
+ :type first_only: bool
"""
+ if isinstance(sql, str):
+ sql = [sql]
with closing(self.get_conn()) as conn:
with closing(conn.cursor()) as cur:
- if parameters is not None:
- cur.execute(sql, parameters)
+ for sql_statement in sql:
+ if parameters is not None:
+ cur.execute(sql_statement, parameters)
+ else:
+ cur.execute(sql_statement)
Review comment:
Do we need this if? I would expect that if we can do
`cur.execute(sql_statement)` then default value for parameters is `None` so we
can remove this if clause
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]