Files
genai-toolbox/docs/sources/spanner.md
2024-12-16 11:03:14 -08:00

2.3 KiB

Spanner Source

Spanner fully managed, mission-critical database service that brings together relational, graph, key-value, and search. It offers transactional consistency at global scale, automatic, synchronous replication for high availability, and support for two SQL dialects: GoogleSQL (ANSI 2011 with extensions) and PostgreSQL.

If you are new to Spanner, you can try to create and query a database using the Google Cloud console.

Requirements

IAM Identity

By default, Spanner uses the OAuth 2.0 for API authentication and authorization. The Cloud Spanner API uses your Application Default Credentials (ADC) to authorize your connection to Spanner.

In addition to setting the ADC for your server, you need to ensure the IAM identity has been given the following IAM permissions:

  • roles/spanner.databaseUser

Example

sources:
    my-spanner-source:
        kind: "spanner"
        project: "my-project-name"
        instance: "my-instance"
        database: "my_db"
        # dialect: "googlesql"

Reference

field type required description
kind string true Must be "spanner".
project string true Name of the GCP project that the cluster was created in (e.g. "my-project").
instance string true Name of the AlloyDB instance within the cluser (e.g. "my-instance").
database string true Name of the Postgres database to connect to (e.g. "my_db").
dialect string true Name of the dialect type of the Spanner database, must be either googlesql or postgresql. Default: googlesql.