# Google Cloud Spanner

Globally distributed relational database

- Category: Data warehouses
- Runs in: the Phloem cloud

Lets you and Hamming query a Spanner database with SQL, with its tables listed in Trace.

## What Phloem reads
- Tables and views in the default schema — columns, types, interleaved parents and foreign keys — listed in Trace for Hamming and SQL autocomplete
- Tables in named schemas are not listed, but you can still query them by name

## What you need
- The Google Cloud project ID, Spanner instance ID and database name
- A service account JSON key that can read the database. If it cannot, the connection test names the role it needs: `roles/spanner.databaseReader`.

## Connect
1. In the console, open **Connectors**, choose **Add connector**, then **Google Cloud Spanner**.
2. Enter **Project ID**, **Instance ID** and **Database**.
3. Paste the whole key file into **Service Account JSON**.
4. Choose **Test Connection**, then **Create Connection**.

## What Hamming can do
- Run SQL that you or Hamming write, as the service account

## Notes
- Phloem runs any statement, not only `SELECT`. Give the service account read-only access to keep the connector read-only.

## Connection fields

| Field | Type | Required | Notes |
|---|---|---|---|
| Project ID | Text | Yes | Google Cloud project ID |
| Instance ID | Text | Yes | Spanner instance identifier |
| Database | Text | Yes | Spanner database name |
| Service Account JSON | Text | Yes | Paste the full service account JSON credentials |
