Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Info

The Google Drive sink plugin is available in the Hub.

Plugin version: 1.4.01

Sink plugin saves files from the pipeline to Google Drive directory via Google Drive API.

Configuration

Property

Macro Enabled?

Version Introduced

Description

Reference Name

No

Required. Name used to uniquely identify this sink for lineage, annotating metadata, etc.

File Body Field

Yes

Required. Name of the schema field (should be BYTES type) which will be used as body of file. The minimal input schema should contain only this field.

File Name Field

Yes

Optional. Name of the schema field (should be STRING type) which will be used as name of file. In the case it is not set files have randomly generated 16-symbols names.

File Mime Field

Yes

Optional. Name of the schema field (should be STRING type) which will be used as MIME type of file. All MIME types are supported except Google Drive types. In the case it is not set Google API will try to recognize file’s MIME type automatically.

Directory Identifier

No

Required. Identifier of the destination folder.

This comes after folders/ in the URL. For example, if the URL is

Code Block
https://drive.google.com/drive/folders/1dyUEebJaFnWa3Z4n0BFMVAXQ7mfUH11g?resourcekey=0-XVijrJSp3E3gkdJp20MpCQ

Then the Directory Identifier would be 1dyUEebJaFnWa3Z4n0BFMVAXQ7mfUH11g.

Authentication Type

No

Required. Type of authentication used to access Google API. Select

OAuth2 and Service Account types are available.

Make sure that:

  • Google Drive API is enabled in the GCP Project.

  • Google Drive Folder is shared to the service account email used with the required permission.

OAuth2 client credentials can be generated on Google Cloud Credentials Page.

For more information about OAuth2, see Google Drive API Documentation.

Default is OAuth2.

Client ID

No

Optional. OAuth2 Client ID used to identify the application.

Client Secret

No

Optional. OAuth2 Client Secret used to access the authorization server.

Refresh Token

No

Optional. OAuth2 Refresh Token to acquire new access tokens.

Service Account Type

Yes

6.3.0/1.3.0

Optional. Select one of the following options:

  • File Path. File path where the service account is located.

  • JSON. JSON content of the service account.

Make sure that the Google Drive Folder is shared with the service account email. To write files to a Private Google Drive, grant the Editor role to the specified service account email. To write files to a Shared Google Drive Folder, grant the Contributor role to the specified service account.

Service Account File Path

Yes

6.3.0/1.3.0

Optional. Path on the local file system of the service account key used for authorization.

Can be set to 'auto-detect' when running on a Dataproc cluster which needs to be created with the following scopes:

When running on other clusters, the file must be present on every node in the cluster.

When set to auto-detect, the GCE VM needs to be configured with the scope required by the Google Drive API. Otherwise, the preview as well as pipeline run will fail with insufficient permission error. The required scope is https://www.googleapis.com/auth/drive

Default is auto-detect.

Service Account JSON

Yes

1.4.0

Optional. Contents of the service account JSON file. Service Account JSON can be generated on Google Cloud Service Account page.

Steps to Generate OAuth2 Credentials

...