Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make chunk_size in GoogleDriveHook standard #22222

Merged
merged 1 commit into from
Mar 13, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion airflow/providers/google/suite/hooks/drive.py
Original file line number Diff line number Diff line change
Expand Up @@ -219,12 +219,13 @@ def upload_file(
self.log.info("File %s uploaded to gdrive://%s.", local_location, remote_location)
return file.get("id")

def download_file(self, file_id: str, file_handle: IO, chunk_size: int = 104857600):
def download_file(self, file_id: str, file_handle: IO, chunk_size: int = 100 * 1024 * 1024):
"""
Download a file from Google Drive.

:param file_id: the id of the file
:param file_handle: file handle used to write the content to
:param chunk_size: File will be downloaded in chunks of this many bytes.
"""
request = self.get_media_request(file_id=file_id)
self.download_content_from_request(file_handle=file_handle, request=request, chunk_size=chunk_size)