1
-
2
1
.. This file is automatically generated. Do not edit this file directly.
3
2
4
3
Google Cloud Spanner Python Samples
@@ -15,12 +14,10 @@ This directory contains samples for Google Cloud Spanner. `Google Cloud Spanner`
15
14
16
15
.. _Google Cloud Spanner : https://cloud.google.com/spanner/docs
17
16
18
-
19
17
Setup
20
18
-------------------------------------------------------------------------------
21
19
22
20
23
-
24
21
Authentication
25
22
++++++++++++++
26
23
@@ -31,9 +28,6 @@ credentials for applications.
31
28
.. _Authentication Getting Started Guide :
32
29
https://cloud.google.com/docs/authentication/getting-started
33
30
34
-
35
-
36
-
37
31
Install Dependencies
38
32
++++++++++++++++++++
39
33
@@ -48,7 +42,7 @@ Install Dependencies
48
42
.. _Python Development Environment Setup Guide :
49
43
https://cloud.google.com/python/setup
50
44
51
- #. Create a virtualenv. Samples are compatible with Python 3.6 +.
45
+ #. Create a virtualenv. Samples are compatible with Python 2.7 and 3.4 +.
52
46
53
47
.. code-block :: bash
54
48
@@ -64,15 +58,9 @@ Install Dependencies
64
58
.. _pip : https://pip.pypa.io/
65
59
.. _virtualenv : https://virtualenv.pypa.io/
66
60
67
-
68
-
69
-
70
-
71
-
72
61
Samples
73
62
-------------------------------------------------------------------------------
74
63
75
-
76
64
Snippets
77
65
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
78
66
@@ -88,10 +76,32 @@ To run this sample:
88
76
89
77
$ python snippets.py
90
78
91
-
92
79
usage: snippets.py [-h] [--database-id DATABASE_ID]
93
80
instance_id
94
- {create_instance,create_database,insert_data,delete_data,query_data,read_data,read_stale_data,add_column,update_data,query_data_with_new_column,read_write_transaction,read_only_transaction,add_index,query_data_with_index,read_data_with_index,add_storing_index,read_data_with_storing_index,create_table_with_timestamp,insert_data_with_timestamp,add_timestamp_column,update_data_with_timestamp,query_data_with_timestamp,write_struct_data,query_with_struct,query_with_array_of_struct,query_struct_field,query_nested_struct_field,insert_data_with_dml,update_data_with_dml,delete_data_with_dml,update_data_with_dml_timestamp,dml_write_read_transaction,update_data_with_dml_struct,insert_with_dml,query_data_with_parameter,write_with_dml_transaction,update_data_with_partitioned_dml,delete_data_with_partitioned_dml,update_with_batch_dml,create_table_with_datatypes,insert_datatypes_data,query_data_with_array,query_data_with_bool,query_data_with_bytes,query_data_with_date,query_data_with_float,query_data_with_int,query_data_with_string,query_data_with_timestamp_parameter,query_data_with_query_options,create_client_with_query_options}
81
+ {create_database,insert_data,query_data,read_data,
82
+ read_stale_data,add_column,update_data,
83
+ query_data_with_new_column,read_write_transaction,
84
+ read_only_transaction,add_index,query_data_with_index,
85
+ read_data_with_index,add_storing_index,
86
+ read_data_with_storing_index,
87
+ create_table_with_timestamp,insert_data_with_timestamp,
88
+ add_timestamp_column,update_data_with_timestamp,
89
+ query_data_with_timestamp,write_struct_data,
90
+ query_with_struct,query_with_array_of_struct,
91
+ query_struct_field,query_nested_struct_field,
92
+ insert_data_with_dml,update_data_with_dml,
93
+ delete_data_with_dml,update_data_with_dml_timestamp,
94
+ dml_write_read_transaction,update_data_with_dml_struct,
95
+ insert_with_dml,query_data_with_parameter,
96
+ write_with_dml_transaction,
97
+ update_data_with_partitioned_dml,
98
+ delete_data_with_partitioned_dml,update_with_batch_dml,
99
+ create_table_with_datatypes,insert_datatypes_data,
100
+ query_data_with_array,query_data_with_bool,
101
+ query_data_with_bytes,query_data_with_date,
102
+ query_data_with_float,query_data_with_int,
103
+ query_data_with_string,
104
+ query_data_with_timestamp_parameter}
95
105
...
96
106
97
107
This application demonstrates how to do basic operations using Cloud
@@ -101,15 +111,32 @@ To run this sample:
101
111
102
112
positional arguments:
103
113
instance_id Your Cloud Spanner instance ID.
104
- {create_instance,create_database,insert_data,delete_data,query_data,read_data,read_stale_data,add_column,update_data,query_data_with_new_column,read_write_transaction,read_only_transaction,add_index,query_data_with_index,read_data_with_index,add_storing_index,read_data_with_storing_index,create_table_with_timestamp,insert_data_with_timestamp,add_timestamp_column,update_data_with_timestamp,query_data_with_timestamp,write_struct_data,query_with_struct,query_with_array_of_struct,query_struct_field,query_nested_struct_field,insert_data_with_dml,update_data_with_dml,delete_data_with_dml,update_data_with_dml_timestamp,dml_write_read_transaction,update_data_with_dml_struct,insert_with_dml,query_data_with_parameter,write_with_dml_transaction,update_data_with_partitioned_dml,delete_data_with_partitioned_dml,update_with_batch_dml,create_table_with_datatypes,insert_datatypes_data,query_data_with_array,query_data_with_bool,query_data_with_bytes,query_data_with_date,query_data_with_float,query_data_with_int,query_data_with_string,query_data_with_timestamp_parameter,query_data_with_query_options,create_client_with_query_options}
105
- create_instance Creates an instance.
114
+ {create_database, insert_data, delete_data, query_data, read_data,
115
+ read_stale_data, add_column, update_data, query_data_with_new_column,
116
+ read_write_transaction, read_only_transaction, add_index,
117
+ query_data_with_index, read_data_with_index, add_storing_index,
118
+ read_data_with_storing_index, create_table_with_timestamp,
119
+ insert_data_with_timestamp, add_timestamp_column,
120
+ update_data_with_timestamp, query_data_with_timestamp,
121
+ write_struct_data, query_with_struct, query_with_array_of_struct,
122
+ query_struct_field, query_nested_struct_field, insert_data_with_dml,
123
+ update_data_with_dml, delete_data_with_dml,
124
+ update_data_with_dml_timestamp, dml_write_read_transaction,
125
+ update_data_with_dml_struct, insert_with_dml, query_data_with_parameter,
126
+ write_with_dml_transaction, update_data_with_partitioned_dml,
127
+ delete_data_with_partitioned_dml, update_with_batch_dml,
128
+ create_table_with_datatypes, insert_datatypes_data,
129
+ query_data_with_array, query_data_with_bool, query_data_with_bytes,
130
+ query_data_with_date, query_data_with_float, query_data_with_int,
131
+ query_data_with_string, query_data_with_timestamp_parameter}
106
132
create_database Creates a database and tables for sample data.
107
133
insert_data Inserts sample data into the given database. The
108
134
database and table must already exist and can be
109
135
created using ` create_database` .
110
136
delete_data Deletes sample data from the given database. The
111
- database, table, and data must already exist and can
112
- be created using ` create_database` and ` insert_data` .
137
+ database, table, and data must already exist and
138
+ can be created using ` create_database` and
139
+ ` insert_data` .
113
140
query_data Queries sample data from the database using SQL.
114
141
read_data Reads sample data from the database.
115
142
read_stale_data Reads sample data from the database. The data is
@@ -210,53 +237,59 @@ To run this sample:
210
237
Deletes sample data from the database using a DML
211
238
statement.
212
239
update_data_with_dml_timestamp
213
- Updates data with Timestamp from the database using a
214
- DML statement.
240
+ Updates data with Timestamp from the database using
241
+ a DML statement.
215
242
dml_write_read_transaction
216
243
First inserts data then reads it from within a
217
244
transaction using DML.
218
245
update_data_with_dml_struct
219
246
Updates data with a DML statement and STRUCT
220
247
parameters.
221
- insert_with_dml Inserts data with a DML statement into the database.
248
+ insert_with_dml Inserts data with a DML statement into the
249
+ database.
222
250
query_data_with_parameter
223
- Queries sample data from the database using SQL with a
224
- parameter.
251
+ Queries sample data from the database using SQL
252
+ with a parameter.
225
253
write_with_dml_transaction
226
- Transfers part of a marketing budget from one album to
227
- another.
254
+ Transfers part of a marketing budget from one
255
+ album to another.
228
256
update_data_with_partitioned_dml
229
- Update sample data with a partitioned DML statement.
257
+ Update sample data with a partitioned DML
258
+ statement.
230
259
delete_data_with_partitioned_dml
231
- Delete sample data with a partitioned DML statement.
260
+ Delete sample data with a partitioned DML
261
+ statement.
232
262
update_with_batch_dml
233
- Updates sample data in the database using Batch DML.
263
+ Updates sample data in the database using Batch
264
+ DML.
234
265
create_table_with_datatypes
235
266
Creates a table with supported dataypes.
236
267
insert_datatypes_data
237
268
Inserts data with supported datatypes into a table.
238
269
query_data_with_array
239
- Queries sample data using SQL with an ARRAY parameter.
270
+ Queries sample data using SQL with an ARRAY
271
+ parameter.
240
272
query_data_with_bool
241
- Queries sample data using SQL with a BOOL parameter.
273
+ Queries sample data using SQL with a BOOL
274
+ parameter.
242
275
query_data_with_bytes
243
- Queries sample data using SQL with a BYTES parameter.
276
+ Queries sample data using SQL with a BYTES
277
+ parameter.
244
278
query_data_with_date
245
- Queries sample data using SQL with a DATE parameter.
279
+ Queries sample data using SQL with a DATE
280
+ parameter.
246
281
query_data_with_float
247
282
Queries sample data using SQL with a FLOAT64
248
283
parameter.
249
284
query_data_with_int
250
- Queries sample data using SQL with a INT64 parameter.
285
+ Queries sample data using SQL with a INT64
286
+ parameter.
251
287
query_data_with_string
252
- Queries sample data using SQL with a STRING parameter.
288
+ Queries sample data using SQL with a STRING
289
+ parameter.
253
290
query_data_with_timestamp_parameter
254
291
Queries sample data using SQL with a TIMESTAMP
255
292
parameter.
256
- query_data_with_query_options
257
- Queries sample data using SQL with query options.
258
- create_client_with_query_options
259
- Create a client with query options.
260
293
261
294
optional arguments:
262
295
-h, --help show this help message and exit
@@ -267,10 +300,6 @@ To run this sample:
267
300
268
301
269
302
270
-
271
-
272
-
273
-
274
303
The client library
275
304
-------------------------------------------------------------------------------
276
305
@@ -286,5 +315,4 @@ to `browse the source`_ and `report issues`_.
286
315
https://github.com/GoogleCloudPlatform/google-cloud-python/issues
287
316
288
317
289
-
290
- .. _Google Cloud SDK : https://cloud.google.com/sdk/
318
+ .. _Google Cloud SDK : https://cloud.google.com/sdk/
0 commit comments