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* | Entity Framework | Active Record | SQLAlchemy | Django | NHibernate |
---|---|---|---|---|---|---|---|---|---|---|---|
Language | Go | Go | Java | Java | Java | Java | C# | Ruby | Python | Python | C# |
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 | View | View | View | 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.
Feature | Spanner JDBC | PostgreSQL JDBC | Hibernate | pgx | GORM | psycopg2 | psycopg3 | SQLAlchemy 2 | node-postgres |
---|---|---|---|---|---|---|---|---|---|
Language | Java | Java | Java | Go | Go | Python | Python | Python | Node.js |
Statement hints | |||||||||
Mutations | |||||||||
Batch DML | |||||||||
Batch DDL | |||||||||
Stale reads | |||||||||
Interleaved tables | |||||||||
Partitioned DML | |||||||||
Session labeling | |||||||||
Request priority | |||||||||
Request tagging | |||||||||
Limitations | View | View | View | View | View | View | View | View |