This page describes the drivers that are supported for Spanner for GoogleSQL-dialect databases and PostgreSQL-dialect databases.
Google supports open-source Spanner drivers for several popular object-relational mapping libraries (ORMs) and frameworks. These drivers allow the use of Spanner databases through APIs defined by those frameworks.
The following tables list all the open-source ORMs and drivers that are supported for Spanner and the features that each one supports. There is one table for each supported SQL dialect.
You can also use the Spanner client libraries to access the Spanner API. For more information, see Spanner client libraries.
GoogleSQL drivers and ORMs
| Feature | database/sql | GORM | Spanner JDBC | Hibernate | Spring Data | R2DBC* | ADO.NET | Entity Framework | Active Record | SQLAlchemy | Django |
|---|---|---|---|---|---|---|---|---|---|---|---|
| Language | Go | Go | Java | Java | Java | Java | C# | C# | Ruby | Python | Python |
| Statement hints | † | ||||||||||
| Mutations | |||||||||||
| Batch DML | |||||||||||
| Batch DDL | |||||||||||
| Stale reads | |||||||||||
| Interleaved tables | |||||||||||
| Partitioned DML | |||||||||||
| Session labeling | |||||||||||
| Request priority | |||||||||||
| JSON type | |||||||||||
| Request tagging | |||||||||||
| Google SQL dialect | |||||||||||
| PostgreSQL dialect | |||||||||||
| Limitations | N/A | View | N/A | View | N/A | N/A | N/A | View | View | View | View |
* This column describes R2DBC when used specifically with Spring Data.
† Available only when sending literal SQL queries, by using the Spring Data
@Query annotation.
PostgreSQL drivers and ORMs
All PostgreSQL drivers require the PGAdapter proxy to be running. For more information, see About PGAdapter.
Supported drivers
| Feature | Spanner JDBC | PostgreSQL JDBC | pgx | psycopg2 | psycopg3 | node-postgres | Npgsql | R2DBC | ADBC |
|---|---|---|---|---|---|---|---|---|---|
| Language | Java | Java | Go | Python | Python | Node.js | .NET | Java | Python |
| Statement hints | |||||||||
| Mutations | |||||||||
| Batch DML | |||||||||
| Batch DDL | |||||||||
| Stale reads | |||||||||
| Interleaved tables | |||||||||
| Partitioned DML | |||||||||
| Session labeling | |||||||||
| Request priority | |||||||||
| Request tagging | |||||||||
| Limitations | N/A | View | View | View | View | View | N/A | N/A | View |
Supported ORMs
| Feature | Hibernate | Spring Data | GORM | SQLAlchemy 2 |
|---|---|---|---|---|
| Language | Java | Java | Go | Python |
| Statement hints | ||||
| Mutations | ||||
| Batch DML | ||||
| Batch DDL | ||||
| Stale reads | ||||
| Interleaved tables | ||||
| Partitioned DML | ||||
| Session labeling | ||||
| Request priority | ||||
| Request tagging | ||||
| Limitations | View | View | View | View |
Supported IDEs and SQL clients
The following tools can connect to PostgreSQL-dialect databases by using PGAdapter.
| Tool | Guide | Notes |
|---|---|---|
| IntelliJ / DataGrip | Setup guide | Requires PGAdapter. |
| DBeaver | Setup guide | Requires PGAdapter. |
| psql | Setup guide | Standard PostgreSQL command-line tool. |
Other integrations
| Tool | Language | Guide | Notes |
|---|---|---|---|
| postgres_fdw | C / Extension | Example | Foreign Data Wrapper for PostgreSQL. |
| connectorx | Python / Rust | Example | High-performance data loading library. |
| Liquibase | Java | Example | Database schema change management. |