uranusjr commented on a change in pull request #21630:
URL: https://github.com/apache/airflow/pull/21630#discussion_r810858737
##########
File path: airflow/providers/presto/hooks/presto.py
##########
@@ -111,27 +112,87 @@ def get_isolation_level(self) -> Any:
def _strip_sql(sql: str) -> str:
return sql.strip().rstrip(';')
- def get_records(self, hql, parameters: Optional[dict] = None):
- """Get a set of records from Presto"""
+ @overload
+ def get_records(self, sql: str = "", parameters: Optional[dict] = None):
+ """Get a set of records from Presto
+
+ :param sql: SQL statement to be executed.
+ :param parameters: The parameters to render the SQL query with.
+ """
+
+ @overload
+ def get_records(self, sql: str = "", parameters: Optional[dict] = None,
hql: str = ""):
+ ...
Review comment:
This should either have a docstring explaining `hql` is deprecated, or a
`:sphinx-autoapi-skip:` so it’s hidden in documentation altogether.
Personally I think we can skip it; since the `hql` and `sql` arguments are
exactly the same, we don’t need to show the old signature in documentation.
People should use the new `sql` argument, and if they are using the old one
right now, well, they already know it exists and does not need documentation.
##########
File path: airflow/providers/presto/hooks/presto.py
##########
@@ -111,27 +112,87 @@ def get_isolation_level(self) -> Any:
def _strip_sql(sql: str) -> str:
return sql.strip().rstrip(';')
- def get_records(self, hql, parameters: Optional[dict] = None):
- """Get a set of records from Presto"""
+ @overload
+ def get_records(self, sql: str = "", parameters: Optional[dict] = None):
+ """Get a set of records from Presto
+
+ :param sql: SQL statement to be executed.
+ :param parameters: The parameters to render the SQL query with.
+ """
+
+ @overload
+ def get_records(self, sql: str = "", parameters: Optional[dict] = None,
hql: str = ""):
+ ...
+
+ def get_records(self, sql: str = "", parameters: Optional[dict] = None,
hql=None):
Review comment:
```suggestion
def get_records(self, sql: str = "", parameters: Optional[dict] = None,
hql: str = ""):
```
This does not need to change?
--
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]