Overview of APIs, client libraries, and ORM drivers

Available interfaces

You can use one of several programmatic interfaces when interacting withSpanner. These are the available interfaces, in the order that werecommend using them:

  • Client libraries: The Spanner client librariesare available in multiple languages and are built ongRPC. Theseclient libraries provide a layer of abstraction on top of gRPC and handle thedetails of session management, transaction execution, retries, and more.
  • ORM and framework drivers: Google supports open-sourceSpanner drivers for several popular object-relational mappinglibraries (ORMs) and frameworks, such as JDBC. These drivers allow the use ofSpanner databases through APIs defined by those frameworks.
  • RPC API: If a client library or ORM driver is not available for yourprogramming language of choice, use the RPC API, which is built ongRPC. gRPC offers a number of performance benefits compared withusing the REST API, including representing objects in protocol buffer format(which are faster to produce and consume compared with JSON) and persistentconnections (which result in less per-request overhead). Read more aboutthese and other benefits ingRPC Concepts.
  • REST API: If you're unable to use Spanner's clientlibraries or the RPC API, use the REST API. Note that some features that areavailable in the RPC API are not supported in the REST API, as documentedbelow.

RPC versus REST API

This table compares Spanner features available through its RPCand REST API interfaces.

FeatureSupported in theRPC API?Supported in theREST API?
Cancelling a request Yes No
Setting a deadline or timeout on a request Yes No
Sending a streaming request Yes. seeExecuteStreamingSQL andStreamingRead.Partial.HTTP Streaming is supported but application-levelflow control is not.

Client libraries features support

The following table lists the client libraries, noting the majorSpanner features that each one supports.

ClientGoJavaNode.jsPythonRubyC++PHPC#
Batch DDL
Batch DML
Configurable leaderoption
Graph queries
Interleavedtables
JSON type
Mutations
Partitioned DML
Partitionedread
PostgreSQLinterface
Requestpriority
Requesttagging
Session labeling
Stale reads
Statement hints
Client metrics

Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2026-02-19 UTC.