google-cloud-spanner
Google Cloud Spanner API client library
Decision gist · record as of 2026-08-14
Yes. google-cloud-spanner is a production-stable, actively maintained client library with low install friction, no known vulnerabilities, and permissive licensing. Install it if you are building on Google Cloud Spanner and need a Python interface. The main prerequisite is GCP credentials and an existing Spanner instance; the library itself is straightforward to set up.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Requires Google Cloud Platform credentials configured (via GOOGLE_APPLICATION_CREDENTIALS environment variable or Application Default Credentials) and an active Cloud Spanner instance and database.
- Low install friction with a pure-wheel distribution.
- Active maintenance with a release 8 days ago and 5371 repository stars.
License · maintenance · safety
Apache-2.0 (permissive) — Licensed under Apache-2.0 (permissive), allowing use in commercial and private projects with minimal restrictions beyond attribution and liability disclaimers.
last release 2026-08-06 (8 days) · last repo commit 2026-08-14 · 5,371 stars
0 known vulnerabilities (OSV.dev, 2026-08-14) · 54,592,845 downloads/mo, #542 on PyPI
Alternatives
Verify before relying
pip install google-cloud-spanner
from google.cloud import spanner
client = spanner.Client()
instance = client.instance('instance-id')
database = instance.database('database-id')
def callback(transaction):
result = transaction.execute_sql('SELECT * FROM table')
for row in result:
print(row)
database.run_in_transaction(callback)- Performance characteristics and latency profiles for typical workloads not documented in the excerpt.
- Exact version compatibility with specific gRPC or protobuf versions not specified in the fact sheet.
- Whether connection pooling or concurrent transaction limits are enforced by the client library.
What it is and what it does
google-cloud-spanner is the official Python client for Google Cloud Spanner, Google's managed, globally distributed relational database. It abstracts the gRPC communication layer and provides a Pythonic API for executing SQL queries, managing transactions, and performing data mutations (inserts, updates, deletes) against Spanner instances. The library supports both transaction-based operations via callbacks and a PEP-249-style connection API for compatibility with existing database tooling.
The package depends on Google's authentication and API infrastructure (google-auth, google-api-core, google-cloud-core) plus gRPC for transport, and includes observability hooks via OpenTelemetry. It handles parameterized queries to prevent SQL injection, supports both DML statements and lower-level mutation operations, and integrates with Cloud Monitoring for operational visibility. Installation is straightforward on modern Python (3.10+), but use requires active GCP credentials and a provisioned Spanner database.
Use it for
- Build applications that read and write to a globally distributed, strongly consistent relational database without managing replication or failover.
- Execute parameterized SQL queries and transactions within a callback-based transaction model to ensure ACID semantics.
- Perform bulk inserts or updates using the mutation API for efficient batch operations on Spanner tables.
- Integrate Spanner database access into existing Python applications using the PEP-249 connection and cursor interface.
- Monitor database operations and latency through built-in OpenTelemetry instrumentation for observability.
- Implement fine-grained access control by connecting as a specific database role for multi-tenant or RBAC scenarios.
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes.
google-cloud-spanner is a production-stable, actively maintained client library with low install friction, no known vulnerabilities, and permissive licensing. Install it if you are building on Google Cloud Spanner and need a Python interface. The main prerequisite is GCP credentials and an existing Spanner instance; the library itself is straightforward to set up.
Install
google-cloud-spanner on PyPI
Before you install
Low install friction with a pure-wheel distribution. Active maintenance with a release 8 days ago and 5371 repository stars. Supports current Python versions (3.10 through 3.14) and has 15 runtime dependencies, all from the Google Cloud ecosystem and standard libraries.
Requires Google Cloud Platform credentials configured (via GOOGLE_APPLICATION_CREDENTIALS environment variable or Application Default Credentials) and an active Cloud Spanner instance and database.
License in practice
Licensed under Apache-2.0 (permissive), allowing use in commercial and private projects with minimal restrictions beyond attribution and liability disclaimers.
Quickstart
pip install google-cloud-spanner
from google.cloud import spanner
client = spanner.Client()
instance = client.instance('instance-id')
database = instance.database('database-id')
def callback(transaction):
result = transaction.execute_sql('SELECT * FROM table')
for row in result:
print(row)
database.run_in_transaction(callback)
Verify before relying
- Performance characteristics and latency profiles for typical workloads not documented in the excerpt.
- Exact version compatibility with specific gRPC or protobuf versions not specified in the fact sheet.
- Whether connection pooling or concurrent transaction limits are enforced by the client library.
Package facts
| License | Apache-2.0 permissive |
| Python support | Supports the current Python release >=3.10 |
| Install friction | Low. Pure-Python wheel |
| Runtime dependencies | 15 packagesgoogle-api-coregoogle-authgoogle-cloud-coregrpciogrpc-google-iam-v1proto-plusprotobufgrpc-interceptorsqlparseopentelemetry-apiopentelemetry-sdkopentelemetry-semantic-conventionsopentelemetry-resourcedetector-gcpgoogle-cloud-monitoringmmh3 |
| Maintenance | Actively maintained 8 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 54,592,845 / month, #542 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
| Classifiers | Development Status :: 5 - Production/StableIntended Audience :: DevelopersLicense :: OSI Approved :: Apache Software LicenseOperating System :: OS IndependentProgramming Language :: PythonProgramming Language :: Python :: 3Programming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.14Topic :: Internet |
Evidence: google_cloud_spanner-3.69.1-py3-none-any.whl
Tags
Let your AI agent find packages like this
Example. Real query, live index.
You found this page by searching. An agent finds it by wishing: SkillFed indexes 14,416 PyPI packages by what they can do, searchable in plain language.
wish › “cloud spanner python client”
- google-cloud-spannerPython client library for Google Cloud Spanner, a managed globally…
- sqlalchemy-spannerProvides a SQLAlchemy dialect that enables applications to use…
- db-dtypesProvides pandas extension data types for SQL systems like BigQuery…
Give your agent the search over MCP, or paste the wish link into any chat.
More Internet packages
Botocore provides low-level, data-driven access to Amazon Web Services APIs, serving as the foundation for the AWS CLI and boto3 libraries.
Install it if you need programmatic access to AWS services.
Provides an async client for AWS services using botocore and aiohttp, allowing you to call AWS APIs asynchronously within asyncio-based applications.
Install it if you need to call AWS services from async Python code; it is the standard way to do so.
Pydantic validates Python data structures against type hints, coercing and checking input at runtime to ensure it matches a declared schema.
Provides a platform-independent file locking mechanism to coordinate access to files across processes and threads.
FastAPI is a Python web framework for building REST APIs using type hints, with automatic request validation, serialization, and interactive API documentation.
Provides common Protocol Buffer message definitions used across Google Cloud APIs, enabling Python clients to interact with Google services.
See also sqlalchemy-spanner · google-cloud-alloydb · google-cloud-dataform · google-cloud-datastore · google-cloud-bigtable · google-cloud-tasks · google-cloud-bigquery-reservation · google-cloud-firestore · google-cloud-dns · db-dtypes