> ## Documentation Index
> Fetch the complete documentation index at: https://basedash.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Cloud Spanner

> Connect your Cloud Spanner database to Basedash

Connect your Google Cloud Spanner database to Basedash to visualize and analyze your application data.

## Prerequisites

* A Google Cloud project with Cloud Spanner enabled
* Service account with Spanner access
* Service account key file (JSON)
* Instance and database information

## Connection methods

### Direct connection

1. Open the **Data** page and click **Add data source**
2. Select **Spanner**
3. Enter your connection details:
   * Instance ID
   * Database name
   * JSON key: upload your service account key file. Basedash reads the project ID from the key.
4. Click **Connect**. Basedash checks the connection, then opens the new data source and starts syncing its schema.

![The Spanner connection form in Basedash with an instance ID and database name filled in and a service account JSON key uploaded](https://mintcdn.com/basedash/1uWWcBDZtjMM1cxJ/images/data-sources/databases/spanner/connection-form.webp?fit=max\&auto=format\&n=1uWWcBDZtjMM1cxJ\&q=85\&s=8ba9dd10ebbfdc80a8c3ec05ba354caf)

## Required permissions

Your service account needs the following IAM roles:

* `roles/spanner.databaseReader` - to read data
* `roles/spanner.viewer` - to view instance and database information

## Best practices

* Create a dedicated service account for Basedash
* Grant minimum required permissions
* Regularly rotate service account keys
* Monitor query performance and costs
* Use appropriate instance configurations

## Performance optimization

* Design efficient schemas
* Use appropriate indexes
* Monitor query patterns
* Set up proper backup policies
* Configure appropriate resource limits

## Troubleshooting

For what each connection error means and how to fix it, see [Connection settings](https://basedash.com/docs/data-sources/connection-settings.md#troubleshooting).

* Verify service account permissions
* Check instance and database status
* Monitor quota usage
* Review Spanner audit logs
* Validate network connectivity


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.