dstandish commented on code in PR #28006:
URL: https://github.com/apache/airflow/pull/28006#discussion_r1036434102


##########
airflow/providers/snowflake/hooks/snowflake.py:
##########
@@ -369,15 +369,19 @@ def run(
         with closing(self.get_conn()) as conn:
             self.set_autocommit(conn, autocommit)
 
-            # SnowflakeCursor does not extend ContextManager, so we have to 
ignore mypy error here
-            with closing(conn.cursor(DictCursor)) as cur:  # type: 
ignore[type-var]

Review Comment:
   i guess it's discussed in a faq: 
https://peps.python.org/pep-0249/#frequently-asked-questions
   
   Maybe the problem is thinking about DbApiHook as though it is 1-1 with the 
dbapi spec. If that were the case, then it would not have any methods apart 
from `get_conn` which returns the connection.  Another way to think about it is 
that the DbApiHook is another layer of abstraction that is not quite the same 
thing as dbapi 2.0, but which _wraps around_ and _uses_ dbapi-compatible 
clients in order to do work and add more convenience (and therefore is not 
strictly bound to dbapi 2.0 in its behavior (that wouldn't make sense cus it's 
an entirely different kind of object, namely a hook) and neither is it confined 
to restrict its usage of the underlying clients to strictly dbapi 2.0 features)



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