27
27
28
28
from google .api_core .exceptions import InternalServerError
29
29
from google .api_core .exceptions import ServiceUnavailable
30
- import google .api_core . gapic_v1 . method
30
+ from google .api_core import gapic_v1
31
31
from google .cloud .spanner_v1 ._helpers import _make_value_pb
32
32
from google .cloud .spanner_v1 ._helpers import _merge_query_options
33
33
from google .cloud .spanner_v1 ._helpers import _metadata_with_prefix
@@ -109,7 +109,18 @@ def _make_txn_selector(self): # pylint: disable=redundant-returns-doc
109
109
"""
110
110
raise NotImplementedError
111
111
112
- def read (self , table , columns , keyset , index = "" , limit = 0 , partition = None ):
112
+ def read (
113
+ self ,
114
+ table ,
115
+ columns ,
116
+ keyset ,
117
+ index = "" ,
118
+ limit = 0 ,
119
+ partition = None ,
120
+ * ,
121
+ retry = gapic_v1 .method .DEFAULT ,
122
+ timeout = gapic_v1 .method .DEFAULT ,
123
+ ):
113
124
"""Perform a ``StreamingRead`` API request for rows in a table.
114
125
115
126
:type table: str
@@ -134,6 +145,12 @@ def read(self, table, columns, keyset, index="", limit=0, partition=None):
134
145
from :meth:`partition_read`. Incompatible with
135
146
``limit``.
136
147
148
+ :type retry: :class:`~google.api_core.retry.Retry`
149
+ :param retry: (Optional) The retry settings for this request.
150
+
151
+ :type timeout: float
152
+ :param timeout: (Optional) The timeout for this request.
153
+
137
154
:rtype: :class:`~google.cloud.spanner_v1.streamed.StreamedResultSet`
138
155
:returns: a result set instance which can be used to consume rows.
139
156
@@ -163,7 +180,11 @@ def read(self, table, columns, keyset, index="", limit=0, partition=None):
163
180
partition_token = partition ,
164
181
)
165
182
restart = functools .partial (
166
- api .streaming_read , request = request , metadata = metadata ,
183
+ api .streaming_read ,
184
+ request = request ,
185
+ metadata = metadata ,
186
+ retry = retry ,
187
+ timeout = timeout ,
167
188
)
168
189
169
190
trace_attributes = {"table_id" : table , "columns" : columns }
@@ -186,8 +207,8 @@ def execute_sql(
186
207
query_mode = None ,
187
208
query_options = None ,
188
209
partition = None ,
189
- retry = google . api_core . gapic_v1 .method .DEFAULT ,
190
- timeout = google . api_core . gapic_v1 .method .DEFAULT ,
210
+ retry = gapic_v1 .method .DEFAULT ,
211
+ timeout = gapic_v1 .method .DEFAULT ,
191
212
):
192
213
"""Perform an ``ExecuteStreamingSql`` API request.
193
214
@@ -224,6 +245,12 @@ def execute_sql(
224
245
:rtype: :class:`~google.cloud.spanner_v1.streamed.StreamedResultSet`
225
246
:returns: a result set instance which can be used to consume rows.
226
247
248
+ :type retry: :class:`~google.api_core.retry.Retry`
249
+ :param retry: (Optional) The retry settings for this request.
250
+
251
+ :type timeout: float
252
+ :param timeout: (Optional) The timeout for this request.
253
+
227
254
:raises ValueError:
228
255
for reuse of single-use snapshots, or if a transaction ID is
229
256
already pending for multiple-use snapshots.
@@ -296,6 +323,9 @@ def partition_read(
296
323
index = "" ,
297
324
partition_size_bytes = None ,
298
325
max_partitions = None ,
326
+ * ,
327
+ retry = gapic_v1 .method .DEFAULT ,
328
+ timeout = gapic_v1 .method .DEFAULT ,
299
329
):
300
330
"""Perform a ``PartitionRead`` API request for rows in a table.
301
331
@@ -323,6 +353,12 @@ def partition_read(
323
353
service uses this as a hint, the actual number of partitions may
324
354
differ.
325
355
356
+ :type retry: :class:`~google.api_core.retry.Retry`
357
+ :param retry: (Optional) The retry settings for this request.
358
+
359
+ :type timeout: float
360
+ :param timeout: (Optional) The timeout for this request.
361
+
326
362
:rtype: iterable of bytes
327
363
:returns: a sequence of partition tokens
328
364
@@ -357,7 +393,9 @@ def partition_read(
357
393
with trace_call (
358
394
"CloudSpanner.PartitionReadOnlyTransaction" , self ._session , trace_attributes
359
395
):
360
- response = api .partition_read (request = request , metadata = metadata ,)
396
+ response = api .partition_read (
397
+ request = request , metadata = metadata , retry = retry , timeout = timeout ,
398
+ )
361
399
362
400
return [partition .partition_token for partition in response .partitions ]
363
401
@@ -368,6 +406,9 @@ def partition_query(
368
406
param_types = None ,
369
407
partition_size_bytes = None ,
370
408
max_partitions = None ,
409
+ * ,
410
+ retry = gapic_v1 .method .DEFAULT ,
411
+ timeout = gapic_v1 .method .DEFAULT ,
371
412
):
372
413
"""Perform a ``PartitionQuery`` API request.
373
414
@@ -394,6 +435,12 @@ def partition_query(
394
435
service uses this as a hint, the actual number of partitions may
395
436
differ.
396
437
438
+ :type retry: :class:`~google.api_core.retry.Retry`
439
+ :param retry: (Optional) The retry settings for this request.
440
+
441
+ :type timeout: float
442
+ :param timeout: (Optional) The timeout for this request.
443
+
397
444
:rtype: iterable of bytes
398
445
:returns: a sequence of partition tokens
399
446
@@ -438,7 +485,9 @@ def partition_query(
438
485
self ._session ,
439
486
trace_attributes ,
440
487
):
441
- response = api .partition_query (request = request , metadata = metadata ,)
488
+ response = api .partition_query (
489
+ request = request , metadata = metadata , retry = retry , timeout = timeout ,
490
+ )
442
491
443
492
return [partition .partition_token for partition in response .partitions ]
444
493
0 commit comments