Cloud Spanner API - Module Google::Cloud (v2.20.0) Stay organized with collections Save and categorize content based on your preferences.
Reference documentation and code samples for the Cloud Spanner API module Google::Cloud.
Methods
.spanner
defself.spanner(project_id=nil,credentials=nil,scope:nil,timeout:nil,lib_name:nil,lib_version:nil)->Google::Cloud::Spanner::ProjectCreates a new object for connecting to the Spanner service.Each call creates a new connection.
For more information on connecting to Google Cloud see theAuthentication Guide.
- project_id (String) — Project identifier for the Spanner service youare connecting to. If not present, the default project for thecredentials is used.
- credentials (String, Hash, Google::Auth::Credentials) — The path tothe keyfile as a String, the contents of the keyfile as a Hash, or aGoogle::Auth::Credentials object. (SeeSpanner::Credentials)
- scope (String, Array<String>)(defaults to: nil) —
The OAuth 2.0 scopes controlling theset of resources and operations that the connection can access. SeeUsing OAuth 2.0 to Access GoogleAPIs.
The default scopes are:
https://www.googleapis.com/auth/spannerhttps://www.googleapis.com/auth/spanner.data
- timeout (Integer)(defaults to: nil) — Default timeout to use in requests. Optional.
- lib_name (String)(defaults to: nil) — Library name. This will be added as a prefixto the API call tracking header
x-goog-api-clientwith providedlib version for telemetry. Optional. For example prefix looks likespanner-activerecord/0.0.1 gccl/1.13.1. Here,spanner-activerecord/0.0.1is provided custom library name andversion andgccl/1.13.1represents the Cloud Spanner Ruby librarywith version. - lib_version (String)(defaults to: nil) — Library version. This will be added as aprefix to the API call tracking header
x-goog-api-clientwithprovided lib name for telemetry. Optional. For example prefix look likespanner-activerecord/0.0.1 gccl/1.13.1. Here,spanner-activerecord/0.0.1is provided custom library name andversion andgccl/1.13.1represents the Cloud Spanner Ruby librarywith version.
require"google/cloud"spanner=Google::Cloud.spanner
#spanner
defspanner(scope:nil,timeout:nil,lib_name:nil,lib_version:nil)->Google::Cloud::Spanner::ProjectCreates a new object for connecting to the Spanner service.Each call creates a new connection.
For more information on connecting to Google Cloud see theAuthentication Guide.
- scope (String, Array<String>)(defaults to: nil) —
The OAuth 2.0 scopes controlling theset of resources and operations that the connection can access. SeeUsing OAuth 2.0 to Access GoogleAPIs.
The default scopes are:
https://www.googleapis.com/auth/spannerhttps://www.googleapis.com/auth/spanner.data
- timeout (Integer)(defaults to: nil) — Default timeout to use in requests. Optional.
- lib_name (String)(defaults to: nil) — Library name. This will be added as a prefixto the API call tracking header
x-goog-api-clientwith providedlib version for telemetry. Optional. For example prefix looks likespanner-activerecord/0.0.1 gccl/1.13.1. Here,spanner-activerecord/0.0.1is provided custom library name andversion andgccl/1.13.1represents the Cloud Spanner Ruby librarywith version. - lib_version (String)(defaults to: nil) — Library version. This will be added as aprefix to the API call tracking header
x-goog-api-clientwithprovided lib name for telemetry. Optional. For example prefix look likespanner-activerecord/0.0.1 gccl/1.13.1. Here,spanner-activerecord/0.0.1is provided custom library name andversion andgccl/1.13.1represents the Cloud Spanner Ruby librarywith version.
require"google/cloud"gcloud=Google::Cloud.newspanner=gcloud.spanner
The default scope can be overridden with thescope option:
require"google/cloud"gcloud=Google::Cloud.newplatform_scope="https://www.googleapis.com/auth/cloud-platform"spanner=gcloud.spannerscope:platform_scope
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 2025-11-17 UTC.