Skip to content

Commit

Permalink
Support to upload file to Google Shared Drive (#21319)
Browse files Browse the repository at this point in the history
  • Loading branch information
lihan committed Feb 6, 2022
1 parent 1a77bc6 commit 6b88d43
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 1 addition & 1 deletion airflow/providers/google/suite/hooks/drive.py
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ def upload_file(self, local_location: str, remote_location: str) -> str:
media = MediaFileUpload(local_location)
file = (
service.files()
.create(body=file_metadata, media_body=media, fields="id")
.create(body=file_metadata, media_body=media, fields="id", supportsAllDrives=True)
.execute(num_retries=self.num_retries)
)
self.log.info("File %s uploaded to gdrive://%s.", local_location, remote_location)
Expand Down
2 changes: 2 additions & 0 deletions tests/providers/google/suite/hooks/test_drive.py
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,7 @@ def test_upload_file_to_root_directory(
body={"name": "remote_path", "parents": ["root"]},
fields="id",
media_body=mock_media_file_upload.return_value,
supportsAllDrives=True,
)
]
)
Expand Down Expand Up @@ -274,6 +275,7 @@ def test_upload_file_to_subdirectory(
body={"name": "remote_path", "parents": ["PARENT_ID"]},
fields="id",
media_body=mock_media_file_upload.return_value,
supportsAllDrives=True,
)
]
)
Expand Down

0 comments on commit 6b88d43

Please sign in to comment.