Skip to content

Commit 3b9a918

Browse files
authored
Bugfix: Fix rendering of object_name in GCSToLocalFilesystemOperator (#15487)
#14918 made coms consistency changes where the template_fields was changed for ``GCSToLocalFilesystemOperator``. While the change was correct since``object`` param was deprecated, the instance attribute wasn't updated hence you see this error: ``` AttributeError: 'GCSToLocalFilesystemOperator' object has no attribute 'object_name' ```
1 parent 4c8a32c commit 3b9a918

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

airflow/providers/google/cloud/transfers/gcs_to_local.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -119,26 +119,26 @@ def __init__(
119119

120120
super().__init__(**kwargs)
121121
self.bucket = bucket
122-
self.object = object_name
122+
self.object_name = object_name
123123
self.filename = filename # noqa
124124
self.store_to_xcom_key = store_to_xcom_key # noqa
125125
self.gcp_conn_id = gcp_conn_id
126126
self.delegate_to = delegate_to
127127
self.impersonation_chain = impersonation_chain
128128

129129
def execute(self, context):
130-
self.log.info('Executing download: %s, %s, %s', self.bucket, self.object, self.filename)
130+
self.log.info('Executing download: %s, %s, %s', self.bucket, self.object_name, self.filename)
131131
hook = GCSHook(
132132
gcp_conn_id=self.gcp_conn_id,
133133
delegate_to=self.delegate_to,
134134
impersonation_chain=self.impersonation_chain,
135135
)
136136

137137
if self.store_to_xcom_key:
138-
file_bytes = hook.download(bucket_name=self.bucket, object_name=self.object)
138+
file_bytes = hook.download(bucket_name=self.bucket, object_name=self.object_name)
139139
if sys.getsizeof(file_bytes) < MAX_XCOM_SIZE:
140140
context['ti'].xcom_push(key=self.store_to_xcom_key, value=str(file_bytes))
141141
else:
142142
raise AirflowException('The size of the downloaded file is too large to push to XCom!')
143143
else:
144-
hook.download(bucket_name=self.bucket, object_name=self.object, filename=self.filename)
144+
hook.download(bucket_name=self.bucket, object_name=self.object_name, filename=self.filename)

0 commit comments

Comments
 (0)