Connecting to Google Spanner
Prerequisites
- The Spanner service is accessible over the network from the PuppyGraph instance.
- A service account with proper permissions (see below) is available for PuppyGraph to connect to Spanner with.
Service Account Permission
PuppyGraph uses a Google Service Account for reading data from Spanner. The service account needs to have the following permissions:
To validate required permission on the service account, you can use the following gcloud
command:
gcloud projects get-iam-policy [PROJECT_ID] --flatten="bindings[].members" --format="table(bindings.role)"
<PROJECT_ID>
with your project ID.
The output should contain the following lines:
Configuration
Configuration | Explanation |
---|---|
JDBC URI | jdbc:cloudspanner:/projects/{ProjectId}/instances/{InstanceName}/databases/{Database} A JDBC compatible connection URI of the data source. Read this page for more details on how to construct the URI. Specifically, the following parameters need to be set according to your service account config:
|
JDBC Driver Class | The class name of the JDBC Driver. The default value is |
Demo
See Querying Google Spanner Data as a Graph for a complete demo for Spanner.