11Spanner
2- =======
2+ ^^^^^^^
3+
4+ `Cloud Spanner `_ is the world's first fully managed relational database service
5+ to offer both strong consistency and horizontal scalability for
6+ mission-critical online transaction processing (OLTP) applications. With Cloud
7+ Spanner you enjoy all the traditional benefits of a relational database; but
8+ unlike any other relational database service, Cloud Spanner scales horizontally
9+ to hundreds or thousands of servers to handle the biggest transactional
10+ workloads.
11+
12+ .. _Cloud Spanner : https://cloud.google.com/spanner/
313
414.. toctree ::
5- :maxdepth: 2
15+ :maxdepth: 1
16+ :titlesonly:
617 :hidden:
718
8- client-usage
919 instance-usage
1020 database-usage
1121 batch-usage
@@ -14,19 +24,77 @@ Spanner
1424 advanced-session-pool-topics
1525 api-reference
1626
17- API requests are sent to the `Cloud Spanner `_ API via RPC over
18- HTTP/2. In order to support this, we'll rely on `gRPC `_.
27+ Spanner Client
28+ ==============
29+
30+ .. _spanner-client :
31+
32+
33+ Instantiating a Client
34+ ----------------------
35+
36+ To use the API, the :class: `~google.cloud.spanner.client.Client `
37+ class defines a high-level interface which handles authorization
38+ and creating other objects:
39+
40+ .. code :: python
41+
42+ from google.cloud import spanner
43+ client = spanner.Client()
44+
45+ Long-lived Defaults
46+ -------------------
47+
48+ When creating a :class: `~google.cloud.spanner.client.Client `, the
49+ ``user_agent `` and ``timeout_seconds `` arguments have sensible
50+ defaults
51+ (:data: `~google.cloud.spanner.client.DEFAULT_USER_AGENT ` and
52+ :data: `~google.cloud.spanner.client.DEFAULT_TIMEOUT_SECONDS `).
53+ However, you may over-ride them and these will be used throughout all API
54+ requests made with the ``client `` you create.
55+
56+ Configuration
57+ -------------
58+
59+ - For an overview of authentication in ``google.cloud-python ``,
60+ see :doc: `/core/auth `.
61+
62+ - In addition to any authentication configuration, you can also set the
63+ :envvar: `GCLOUD_PROJECT ` environment variable for the Google Cloud Console
64+ project you'd like to interact with. If your code is running in Google App
65+ Engine or Google Compute Engine the project will be detected automatically.
66+ (Setting this environment variable is not required, you may instead pass the
67+ ``project `` explicitly when constructing a
68+ :class: `~google.cloud.storage.client.Client `).
69+
70+ - After configuring your environment, create a
71+ :class: `~google.cloud.storage.client.Client `
72+
73+ .. code ::
74+
75+ >>> from google.cloud import spanner
76+ >>> client = spanner.Client()
77+
78+ or pass in ``credentials `` and ``project `` explicitly
79+
80+ .. code ::
81+
82+ >>> from google.cloud import spanner
83+ >>> client = spanner.Client(project='my-project', credentials=creds)
84+
85+ .. tip ::
86+
87+ Be sure to use the **Project ID **, not the **Project Number **.
88+
1989
20- Get started by learning about the :class: ` ~google.cloud.spanner.client.Client `
21- on the :doc: ` client-usage ` page.
90+ Next Step
91+ ---------
2292
23- In the hierarchy of API concepts
93+ After a :class: `~google.cloud.spanner.client.Client `, the next
94+ highest-level object is an :class: `~google.cloud.spanner.instance.Instance `.
95+ You'll need one before you can interact with databases.
2496
25- * a :class: `~google.cloud.spanner.client.Client ` owns an
26- :class: `~google.cloud.spanner.instance.Instance `
27- * an :class: `~google.cloud.spanner.instance.Instance ` owns a
28- :class: `~google.cloud.spanner.database.Database `
97+ Next, learn about the :doc: `instance-usage `.
2998
30- .. _Cloud Spanner : https://cloud.google.com/spanner/docs/
31- .. _gRPC : http://www.grpc.io/
32- .. _grpcio : https://pypi.org/project/grpcio/
99+ .. _Instance Admin : https://cloud.google.com/spanner/reference/rpc/google.spanner.admin.instance.v1
100+ .. _Database Admin : https://cloud.google.com/spanner/reference/rpc/google.spanner.admin.database.v1
0 commit comments