Skip to content

Commit 6b88d43

Browse files
author
lihan
authored
Support to upload file to Google Shared Drive (#21319)
1 parent 1a77bc6 commit 6b88d43

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

β€Žairflow/providers/google/suite/hooks/drive.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ def upload_file(self, local_location: str, remote_location: str) -> str:
200200
media = MediaFileUpload(local_location)
201201
file = (
202202
service.files()
203-
.create(body=file_metadata, media_body=media, fields="id")
203+
.create(body=file_metadata, media_body=media, fields="id", supportsAllDrives=True)
204204
.execute(num_retries=self.num_retries)
205205
)
206206
self.log.info("File %s uploaded to gdrive://%s.", local_location, remote_location)

β€Žtests/providers/google/suite/hooks/test_drive.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -245,6 +245,7 @@ def test_upload_file_to_root_directory(
245245
body={"name": "remote_path", "parents": ["root"]},
246246
fields="id",
247247
media_body=mock_media_file_upload.return_value,
248+
supportsAllDrives=True,
248249
)
249250
]
250251
)
@@ -274,6 +275,7 @@ def test_upload_file_to_subdirectory(
274275
body={"name": "remote_path", "parents": ["PARENT_ID"]},
275276
fields="id",
276277
media_body=mock_media_file_upload.return_value,
278+
supportsAllDrives=True,
277279
)
278280
]
279281
)

0 commit comments

Comments
 (0)