Apache Airflow Provider(s)
google
Versions of Apache Airflow Providers
apache-airflow-providers-google==6.1.0
Apache Airflow version
2.2.2 (latest released)
Operating System
Debian GNU/Linux 10 (buster)
Deployment
Other Docker-based deployment
Deployment details
No response
What happened
When I'm execute PostgresToGCSOperator on empty table and set use_server_side_cursor=True the operator fails with error:
Traceback (most recent call last):
File "/home/airflow/.local/lib/python3.9/site-packages/airflow/models/taskinstance.py", line 1332, in _run_raw_task
self._execute_task_with_callbacks(context)
File "/home/airflow/.local/lib/python3.9/site-packages/airflow/models/taskinstance.py", line 1458, in _execute_task_with_callbacks
result = self._execute_task(context, self.task)
File "/home/airflow/.local/lib/python3.9/site-packages/airflow/models/taskinstance.py", line 1514, in _execute_task
result = execute_callable(context=context)
File "/home/airflow/.local/lib/python3.9/site-packages/airflow/providers/google/cloud/transfers/sql_to_gcs.py", line 154, in execute
files_to_upload = self._write_local_data_files(cursor)
File "/home/airflow/.local/lib/python3.9/site-packages/airflow/providers/google/cloud/transfers/sql_to_gcs.py", line 213, in _write_local_data_files
row = self.convert_types(schema, col_type_dict, row)
File "/home/airflow/.local/lib/python3.9/site-packages/airflow/providers/google/cloud/transfers/sql_to_gcs.py", line 174, in convert_types
return [self.convert_type(value, col_type_dict.get(name)) for name, value in zip(schema, row)]
TypeError: 'NoneType' object is not iterable
Operator command when I'm using:
task_send = PostgresToGCSOperator(
task_id=f'send_{table}',
postgres_conn_id='postgres_raw',
gcp_conn_id=gcp_conn_id,
sql=f'SELECT * FROM public.{table}',
use_server_side_cursor=True,
bucket=bucket,
filename=f'{table}.csv',
export_format='csv',
)
What you expected to happen
I'm expected, that operator on empty table not creating file and no upload it on Google Cloud.
How to reproduce
- Create empty postgresql table.
- Create dag with task with PostgresToGCSOperator. that upload this table in Google Cloud.
Anything else
No response
Are you willing to submit PR?
Code of Conduct
Apache Airflow Provider(s)
google
Versions of Apache Airflow Providers
apache-airflow-providers-google==6.1.0
Apache Airflow version
2.2.2 (latest released)
Operating System
Debian GNU/Linux 10 (buster)
Deployment
Other Docker-based deployment
Deployment details
No response
What happened
When I'm execute
PostgresToGCSOperatoron empty table and setuse_server_side_cursor=Truethe operator fails with error:Operator command when I'm using:
What you expected to happen
I'm expected, that operator on empty table not creating file and no upload it on Google Cloud.
How to reproduce
Anything else
No response
Are you willing to submit PR?
Code of Conduct