Google Drive to Google Cloud Storage Transfer Operator¶
Google has two services that store data. The Google Cloud Storage is used to store large data from various applications. The Google Drive is used to store daily use data, including documents and photos. Google Cloud Storage has strong integration with Google Cloud services. Google Drive has built-in mechanisms to facilitate group work e.g. document editor, file sharing mechanisms.
Prerequisite Tasks¶
Operator¶
Transfer files between Google Storage and Google Drive is performed with the
GoogleDriveToGCSOperator
operator.
Copy single files¶
The following Operator copies a single file from a shared Google Drive folder to a Google Cloud Storage Bucket.
Note that you can transfer a file from the root folder of a shared drive by passing the id of the shared
drive to both the folder_id
and drive_id
parameters.
upload_gdrive_to_gcs = GoogleDriveToGCSOperator(
task_id="upload_gdrive_object_to_gcs",
folder_id=FOLDER_ID,
file_name=FILE_NAME,
bucket_name=BUCKET,
object_name=OBJECT,
)
You can use Jinja templating with
bucket_name
, object_name
, folder_id
, file_name
, drive_id
, impersonation_chain
parameters which allows you to dynamically determine values.
Reference¶
For further information, look at: