thepabloaguilar commented on a change in pull request #9943:
URL: https://github.com/apache/airflow/pull/9943#discussion_r459482195
##########
File path: airflow/providers/postgres/hooks/postgres.py
##########
@@ -58,7 +59,9 @@ def __init__(self, *args, **kwargs):
self.connection = kwargs.pop("connection", None)
self.conn = None
- def _get_cursor(self, raw_cursor):
+ def _get_cursor(self, raw_cursor: str) -> Union[psycopg2.extras.DictCursor,
+
psycopg2.extras.RealDictCursor,
+
psycopg2.extras.NamedTupleCursor]:
Review comment:
Create the type alias outside of the class:
```python
_CURSOR_TYPE = Union[
psycopg2.extras.DictCursor,
psycopg2.extras.RealDictCursor,
psycopg2.extras.NamedTupleCursor
]
class Example:
def _get_cursor(self, raw_cursor: str) -> _CURSOR_TYPE:
...
```
----------------------------------------------------------------
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]