Create a Gmail connection
Beta
This feature is in Beta. Workspace admins can control access to this feature from the Previews page. See Manage Databricks previews.
Create a Gmail connection in Catalog Explorer to store authentication credentials for Lakeflow Connect ingestion. Any user with the USE CONNECTION privilege on the connection can then create Gmail ingestion pipelines without needing direct access to the credentials.
Alternatively, admin users can create a connection and a pipeline at the same time in the data ingestion UI. See Ingest data from Gmail.
For privilege requirements, see Connect to managed ingestion sources.
Prerequisites
Complete the source setup. Use the service account JSON key and mailbox address you obtain to create the connection.
Create a connection
- In the Databricks workspace, click Catalog > External locations > Connections > Create connection.
- On the Connection basics page of the Set up connection wizard, specify a unique Connection name.
- In the Connection type drop-down menu, select Gmail.
- (Optional) Add a comment.
- Click Next.
- On the Authentication page, enter the following:
- Service account JSON: Paste the full contents of the service account JSON key that you created in the source setup. This value is stored as a secret.
- Mailbox Email: The email address of the mailbox to ingest, for example
user@example.com. This is theimpersonate_emailvalue. The service account uses domain-wide delegation to impersonate this user, so all Gmail API calls read that user's mailbox. Set this to the mailbox you want to ingest. Although the field is not enforced as required, a Google service account has no mailbox of its own, so if you leave it empty the connection authenticates as the service account itself and has no user mailbox to read. To ingest a person's mail, you must specify their address here. For more about how the mailbox is selected, see Mailbox selection. For how to authorize the service account for domain-wide delegation, see Configure Gmail for Databricks ingestion. - OAuth scope: Enter
https://www.googleapis.com/auth/gmail.readonly. The connector requires this read-only scope to access the mailbox.
- Click Create connection.