uranusjr commented on a change in pull request #21630:
URL: https://github.com/apache/airflow/pull/21630#discussion_r810689785



##########
File path: airflow/providers/presto/hooks/presto.py
##########
@@ -111,27 +112,51 @@ 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):
+    def get_records(self, sql: str = "", parameters: Optional[dict] = None, 
hql: str = ""):
         """Get a set of records from Presto"""
+        if hql:
+            warnings.warn(
+                "The hql parameter has been deprecated. You should pass the 
sql parameter.",
+                DeprecationWarning,
+                stacklevel=2,
+            )
+            sql = hql
+
         try:
-            return super().get_records(self._strip_sql(hql), parameters)
+            return super().get_records(self._strip_sql(sql), parameters)
         except DatabaseError as e:
             raise PrestoException(e)
 
-    def get_first(self, hql: str, parameters: Optional[dict] = None) -> Any:
+    def get_first(self, sql: str = "", parameters: Optional[dict] = None, hql: 
str = "") -> Any:

Review comment:
       Can you add some `@overload` signatures and markers so `hql` does not 
show up in documentation? (Especially not _together_ with `sql` so users don’t 
get confused with the two.)
   
   Something like
   
   ```python
   @overload
   def get_first(self, sql: str, parameters: Optional[dict] = None) -> Any:
       """Return only the first row, regardless of how many rows the query 
returns.
   
       :param sql: SQL string to execute.
       :param parameters: Something something
       """
       ...
   
   def get_first(self, sql: str = "", parameters: Optional[dict] = None, hql: 
str = "") -> Any:
       """:sphinx-autoapi-skip:"""
       # Actual implementation...
   ```




-- 
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]


Reply via email to