dwreeves commented on code in PR #31846:
URL: https://github.com/apache/airflow/pull/31846#discussion_r1227168684


##########
airflow/providers/databricks/hooks/databricks_sql.py:
##########
@@ -138,15 +141,39 @@ def get_conn(self) -> Connection:
             )
         return self._sql_conn
 
+    @overload
+    def run(
+        self,
+        sql: str | Iterable[str],
+        autocommit: bool = False,
+        parameters: Iterable | Mapping | None = None,
+        handler: None = None,
+        split_statements: bool = True,
+        return_last: bool = True,
+    ) -> None:
+        ...
+
+    @overload
+    def run(
+        self,
+        sql: str | Iterable[str],
+        autocommit: bool = False,
+        parameters: Iterable | Mapping | None = None,

Review Comment:
   Actually, I'm going to be careful here because Airflow supports SQLAlchemy 
1.4, which doesn't have type annotations. I see for example that Pandas does 
this type annotation for its "params":
   
   ```python
       params: list[Any] | Mapping[str, Any] | None = None,
   ```
   
   with this comment in the docstring:
   
   ```
       params : list, tuple or mapping, optional, default: None
           List of parameters to pass to execute method.  The syntax used
           to pass parameters is database driver dependent. Check your
           database driver documentation for which of the five syntax styles,
           described in PEP 249's paramstyle, is supported.
           Eg. for psycopg2, uses %(name)s so use params={'name' : 'value'}.
   ```
   
   So out of abundance of caution I'll just do `Iterable | Mapping[str, Any]`.
   
   But when Airflow locks to SQLAlchemy 2.x, I think it'll be safe to do 
`Iterable[Mapping[str, Any]]`.



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