You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by GitBox <gi...@apache.org> on 2022/02/03 21:15:33 UTC
[GitHub] [airflow] kazanzhy commented on a change in pull request #21307: Fixed error in PostgresToGCSOperator on the empty resultset
kazanzhy commented on a change in pull request #21307:
URL: https://github.com/apache/airflow/pull/21307#discussion_r798974645
##########
File path: airflow/providers/google/cloud/transfers/postgres_to_gcs.py
##########
@@ -41,26 +41,22 @@ class _PostgresServerSideCursorDecorator:
def __init__(self, cursor):
self.cursor = cursor
- self.rows = []
self.initialized = False
def __iter__(self):
return self
def __next__(self):
- if self.rows:
- return self.rows.pop()
- else:
- self.initialized = True
- return next(self.cursor)
+ self.initialized = True
+ return next(self.cursor)
@property
def description(self):
"""Fetch first row to initialize cursor description when using server side cursor."""
if not self.initialized:
- element = self.cursor.fetchone()
- self.rows.append(element)
self.initialized = True
+ self.cursor.fetchone()
+ self.cursor.scroll(0, mode='absolute')
Review comment:
If `.scroll(-1)` is more clear then I 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: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org