Spanner
Learn how to set up a Spanner source connection.
GrowthLoop connects directly to Spanner so you can use customer data from your operational database to create audiences without copying that data into GrowthLoop.
To establish the connection to Spanner, complete these steps:
- Create a GCP service account
- Configure Spanner permissions
- Confirm the Spanner instance and database identifiers
- Connect Spanner to the GrowthLoop app
Create a GCP Service Account
Create a service account in the GCP project that contains the Spanner instance and database you want to connect.
In Google Cloud Console:
- Open the project where your Spanner database lives.
- Navigate to IAM & Admin.
- Click Service Accounts.
- Click Create service account.
- Enter a service account name, service account ID, and description.
- Click Create and continue.
You will use this service account to authenticate GrowthLoop to Spanner.
Configure Spanner Permissions
Grant the service account access to the Spanner database you want GrowthLoop to read from.
For read-only access, grant:
- Cloud Spanner Database Reader (
roles/spanner.databaseReader)
This role allows the service account to read from the database, execute SQL queries, and view schema metadata.
If your GrowthLoop setup needs to write back to Spanner, grant:
- Cloud Spanner Database User (
roles/spanner.databaseUser)
This role includes read and write access, SQL query execution, DML, and schema update permissions. Only grant this broader role if your implementation needs write access.
You can grant these roles at the database level or instance level. Prefer the narrowest scope that covers the tables GrowthLoop needs to query.
Create a Service Account Key
After assigning permissions, create a JSON key for the service account.
In Google Cloud Console:
- Open IAM & Admin.
- Click Service Accounts.
- Select the service account you created.
- Open the Keys tab.
- Click Add key.
- Click Create new key.
- Select JSON.
- Click Create.
A JSON key file will download to your computer. Save it somewhere easy to find; you will upload it to GrowthLoop when creating the source connection.
Confirm Your Spanner Connection Details
Before opening GrowthLoop, collect the following values:
- Project ID: The GCP project ID that contains your Spanner instance.
- Instance ID: The Spanner instance ID.
- Database ID: The Spanner database ID.
- Service account key: The JSON key file you downloaded.
You can find the instance and database IDs in Google Cloud Console by navigating to Spanner, selecting your instance, and then selecting the database you want to connect.
Connect Spanner to the GrowthLoop App
In GrowthLoop:
- Open your organization.
- Click New Source Connection.
- Select Spanner.
- Enter a source connection name and optional description.
- Enter the Project ID, Instance ID, and Database ID.
- Select the snapshot dataset value requested by your GrowthLoop setup.
- Upload the service account JSON key.
- Click the credentials check button to validate the connection.
If validation fails, confirm that:
- The service account key belongs to the project you entered.
- The instance ID and database ID are correct.
- The service account has
roles/spanner.databaseReaderor the required equivalent permissions. - The Spanner API is enabled in the GCP project.
Connect Tables
After the source connection is validated, choose the Spanner table you want to add as a GrowthLoop dataset.
When configuring the dataset:
- Select the table that contains the customer data you want to use.
- Choose the unique ID field for the table, such as a customer ID.
- Select any optional identifiers, such as device IDs, if you plan to export audiences to destinations that require them.
- Choose the fields you want available by default when building audiences.
After setup is complete, you can use the Spanner-backed dataset in dataset groups and audience building.
Notes
- Spanner tables in the default schema may appear as Default in Google Cloud Console.
- Keep the service account scoped to the minimum Spanner database or instance permissions required.
- Treat the downloaded JSON key as a secret. If it is exposed, revoke the key in Google Cloud Console and upload a new key in GrowthLoop.
Updated about 18 hours ago