google-cloud-bigtable 2.30.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (115) hide show
  1. google/cloud/bigtable/__init__.py +25 -0
  2. google/cloud/bigtable/app_profile.py +377 -0
  3. google/cloud/bigtable/backup.py +490 -0
  4. google/cloud/bigtable/batcher.py +414 -0
  5. google/cloud/bigtable/client.py +475 -0
  6. google/cloud/bigtable/cluster.py +541 -0
  7. google/cloud/bigtable/column_family.py +362 -0
  8. google/cloud/bigtable/data/__init__.py +103 -0
  9. google/cloud/bigtable/data/_async/__init__.py +25 -0
  10. google/cloud/bigtable/data/_async/_mutate_rows.py +226 -0
  11. google/cloud/bigtable/data/_async/_read_rows.py +363 -0
  12. google/cloud/bigtable/data/_async/client.py +1522 -0
  13. google/cloud/bigtable/data/_async/mutations_batcher.py +534 -0
  14. google/cloud/bigtable/data/_cross_sync/__init__.py +20 -0
  15. google/cloud/bigtable/data/_cross_sync/_decorators.py +441 -0
  16. google/cloud/bigtable/data/_cross_sync/_mapping_meta.py +64 -0
  17. google/cloud/bigtable/data/_cross_sync/cross_sync.py +334 -0
  18. google/cloud/bigtable/data/_helpers.py +249 -0
  19. google/cloud/bigtable/data/_sync_autogen/_mutate_rows.py +182 -0
  20. google/cloud/bigtable/data/_sync_autogen/_read_rows.py +304 -0
  21. google/cloud/bigtable/data/_sync_autogen/client.py +1293 -0
  22. google/cloud/bigtable/data/_sync_autogen/mutations_batcher.py +449 -0
  23. google/cloud/bigtable/data/exceptions.py +340 -0
  24. google/cloud/bigtable/data/execute_query/__init__.py +43 -0
  25. google/cloud/bigtable/data/execute_query/_async/__init__.py +13 -0
  26. google/cloud/bigtable/data/execute_query/_async/execute_query_iterator.py +291 -0
  27. google/cloud/bigtable/data/execute_query/_byte_cursor.py +123 -0
  28. google/cloud/bigtable/data/execute_query/_checksum.py +43 -0
  29. google/cloud/bigtable/data/execute_query/_parameters_formatting.py +155 -0
  30. google/cloud/bigtable/data/execute_query/_query_result_parsing_utils.py +134 -0
  31. google/cloud/bigtable/data/execute_query/_reader.py +122 -0
  32. google/cloud/bigtable/data/execute_query/_sync_autogen/execute_query_iterator.py +239 -0
  33. google/cloud/bigtable/data/execute_query/metadata.py +399 -0
  34. google/cloud/bigtable/data/execute_query/values.py +123 -0
  35. google/cloud/bigtable/data/mutations.py +380 -0
  36. google/cloud/bigtable/data/read_modify_write_rules.py +112 -0
  37. google/cloud/bigtable/data/read_rows_query.py +536 -0
  38. google/cloud/bigtable/data/row.py +535 -0
  39. google/cloud/bigtable/data/row_filters.py +968 -0
  40. google/cloud/bigtable/encryption_info.py +64 -0
  41. google/cloud/bigtable/enums.py +223 -0
  42. google/cloud/bigtable/error.py +64 -0
  43. google/cloud/bigtable/gapic_version.py +16 -0
  44. google/cloud/bigtable/helpers.py +31 -0
  45. google/cloud/bigtable/instance.py +789 -0
  46. google/cloud/bigtable/policy.py +255 -0
  47. google/cloud/bigtable/row.py +1267 -0
  48. google/cloud/bigtable/row_data.py +380 -0
  49. google/cloud/bigtable/row_filters.py +838 -0
  50. google/cloud/bigtable/row_merger.py +250 -0
  51. google/cloud/bigtable/row_set.py +213 -0
  52. google/cloud/bigtable/table.py +1409 -0
  53. google/cloud/bigtable_admin/__init__.py +410 -0
  54. google/cloud/bigtable_admin/gapic_version.py +16 -0
  55. google/cloud/bigtable_admin/py.typed +2 -0
  56. google/cloud/bigtable_admin_v2/__init__.py +250 -0
  57. google/cloud/bigtable_admin_v2/gapic_metadata.json +962 -0
  58. google/cloud/bigtable_admin_v2/gapic_version.py +16 -0
  59. google/cloud/bigtable_admin_v2/py.typed +2 -0
  60. google/cloud/bigtable_admin_v2/services/__init__.py +15 -0
  61. google/cloud/bigtable_admin_v2/services/bigtable_instance_admin/__init__.py +22 -0
  62. google/cloud/bigtable_admin_v2/services/bigtable_instance_admin/async_client.py +3465 -0
  63. google/cloud/bigtable_admin_v2/services/bigtable_instance_admin/client.py +3944 -0
  64. google/cloud/bigtable_admin_v2/services/bigtable_instance_admin/pagers.py +681 -0
  65. google/cloud/bigtable_admin_v2/services/bigtable_instance_admin/transports/__init__.py +40 -0
  66. google/cloud/bigtable_admin_v2/services/bigtable_instance_admin/transports/base.py +751 -0
  67. google/cloud/bigtable_admin_v2/services/bigtable_instance_admin/transports/grpc.py +1249 -0
  68. google/cloud/bigtable_admin_v2/services/bigtable_instance_admin/transports/grpc_asyncio.py +1579 -0
  69. google/cloud/bigtable_admin_v2/services/bigtable_instance_admin/transports/rest.py +6820 -0
  70. google/cloud/bigtable_admin_v2/services/bigtable_instance_admin/transports/rest_base.py +1746 -0
  71. google/cloud/bigtable_admin_v2/services/bigtable_table_admin/__init__.py +22 -0
  72. google/cloud/bigtable_admin_v2/services/bigtable_table_admin/async_client.py +3472 -0
  73. google/cloud/bigtable_admin_v2/services/bigtable_table_admin/client.py +3949 -0
  74. google/cloud/bigtable_admin_v2/services/bigtable_table_admin/pagers.py +669 -0
  75. google/cloud/bigtable_admin_v2/services/bigtable_table_admin/transports/__init__.py +40 -0
  76. google/cloud/bigtable_admin_v2/services/bigtable_table_admin/transports/base.py +708 -0
  77. google/cloud/bigtable_admin_v2/services/bigtable_table_admin/transports/grpc.py +1257 -0
  78. google/cloud/bigtable_admin_v2/services/bigtable_table_admin/transports/grpc_asyncio.py +1549 -0
  79. google/cloud/bigtable_admin_v2/services/bigtable_table_admin/transports/rest.py +6609 -0
  80. google/cloud/bigtable_admin_v2/services/bigtable_table_admin/transports/rest_base.py +1714 -0
  81. google/cloud/bigtable_admin_v2/types/__init__.py +248 -0
  82. google/cloud/bigtable_admin_v2/types/bigtable_instance_admin.py +1364 -0
  83. google/cloud/bigtable_admin_v2/types/bigtable_table_admin.py +1715 -0
  84. google/cloud/bigtable_admin_v2/types/common.py +81 -0
  85. google/cloud/bigtable_admin_v2/types/instance.py +819 -0
  86. google/cloud/bigtable_admin_v2/types/table.py +1028 -0
  87. google/cloud/bigtable_admin_v2/types/types.py +776 -0
  88. google/cloud/bigtable_v2/__init__.py +136 -0
  89. google/cloud/bigtable_v2/gapic_metadata.json +193 -0
  90. google/cloud/bigtable_v2/gapic_version.py +16 -0
  91. google/cloud/bigtable_v2/py.typed +2 -0
  92. google/cloud/bigtable_v2/services/__init__.py +15 -0
  93. google/cloud/bigtable_v2/services/bigtable/__init__.py +22 -0
  94. google/cloud/bigtable_v2/services/bigtable/async_client.py +1741 -0
  95. google/cloud/bigtable_v2/services/bigtable/client.py +2194 -0
  96. google/cloud/bigtable_v2/services/bigtable/transports/__init__.py +38 -0
  97. google/cloud/bigtable_v2/services/bigtable/transports/base.py +343 -0
  98. google/cloud/bigtable_v2/services/bigtable/transports/grpc.py +660 -0
  99. google/cloud/bigtable_v2/services/bigtable/transports/grpc_asyncio.py +762 -0
  100. google/cloud/bigtable_v2/services/bigtable/transports/rest.py +2489 -0
  101. google/cloud/bigtable_v2/services/bigtable/transports/rest_base.py +711 -0
  102. google/cloud/bigtable_v2/types/__init__.py +138 -0
  103. google/cloud/bigtable_v2/types/bigtable.py +1531 -0
  104. google/cloud/bigtable_v2/types/data.py +1612 -0
  105. google/cloud/bigtable_v2/types/feature_flags.py +119 -0
  106. google/cloud/bigtable_v2/types/request_stats.py +171 -0
  107. google/cloud/bigtable_v2/types/response_params.py +64 -0
  108. google/cloud/bigtable_v2/types/types.py +579 -0
  109. google_cloud_bigtable-2.30.0.data/scripts/fixup_bigtable_admin_v2_keywords.py +233 -0
  110. google_cloud_bigtable-2.30.0.data/scripts/fixup_bigtable_v2_keywords.py +186 -0
  111. google_cloud_bigtable-2.30.0.dist-info/LICENSE +202 -0
  112. google_cloud_bigtable-2.30.0.dist-info/METADATA +154 -0
  113. google_cloud_bigtable-2.30.0.dist-info/RECORD +115 -0
  114. google_cloud_bigtable-2.30.0.dist-info/WHEEL +5 -0
  115. google_cloud_bigtable-2.30.0.dist-info/top_level.txt +1 -0
@@ -0,0 +1,660 @@
1
+ # -*- coding: utf-8 -*-
2
+ # Copyright 2024 Google LLC
3
+ #
4
+ # Licensed under the Apache License, Version 2.0 (the "License");
5
+ # you may not use this file except in compliance with the License.
6
+ # You may obtain a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS,
12
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ # See the License for the specific language governing permissions and
14
+ # limitations under the License.
15
+ #
16
+ import json
17
+ import logging as std_logging
18
+ import pickle
19
+ import warnings
20
+ from typing import Callable, Dict, Optional, Sequence, Tuple, Union
21
+
22
+ from google.api_core import grpc_helpers
23
+ from google.api_core import gapic_v1
24
+ import google.auth # type: ignore
25
+ from google.auth import credentials as ga_credentials # type: ignore
26
+ from google.auth.transport.grpc import SslCredentials # type: ignore
27
+ from google.protobuf.json_format import MessageToJson
28
+ import google.protobuf.message
29
+
30
+ import grpc # type: ignore
31
+ import proto # type: ignore
32
+
33
+ from google.cloud.bigtable_v2.types import bigtable
34
+ from .base import BigtableTransport, DEFAULT_CLIENT_INFO
35
+
36
+ try:
37
+ from google.api_core import client_logging # type: ignore
38
+
39
+ CLIENT_LOGGING_SUPPORTED = True # pragma: NO COVER
40
+ except ImportError: # pragma: NO COVER
41
+ CLIENT_LOGGING_SUPPORTED = False
42
+
43
+ _LOGGER = std_logging.getLogger(__name__)
44
+
45
+
46
+ class _LoggingClientInterceptor(grpc.UnaryUnaryClientInterceptor): # pragma: NO COVER
47
+ def intercept_unary_unary(self, continuation, client_call_details, request):
48
+ logging_enabled = CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(
49
+ std_logging.DEBUG
50
+ )
51
+ if logging_enabled: # pragma: NO COVER
52
+ request_metadata = client_call_details.metadata
53
+ if isinstance(request, proto.Message):
54
+ request_payload = type(request).to_json(request)
55
+ elif isinstance(request, google.protobuf.message.Message):
56
+ request_payload = MessageToJson(request)
57
+ else:
58
+ request_payload = f"{type(request).__name__}: {pickle.dumps(request)}"
59
+
60
+ request_metadata = {
61
+ key: value.decode("utf-8") if isinstance(value, bytes) else value
62
+ for key, value in request_metadata
63
+ }
64
+ grpc_request = {
65
+ "payload": request_payload,
66
+ "requestMethod": "grpc",
67
+ "metadata": dict(request_metadata),
68
+ }
69
+ _LOGGER.debug(
70
+ f"Sending request for {client_call_details.method}",
71
+ extra={
72
+ "serviceName": "google.bigtable.v2.Bigtable",
73
+ "rpcName": client_call_details.method,
74
+ "request": grpc_request,
75
+ "metadata": grpc_request["metadata"],
76
+ },
77
+ )
78
+
79
+ response = continuation(client_call_details, request)
80
+ if logging_enabled: # pragma: NO COVER
81
+ response_metadata = response.trailing_metadata()
82
+ # Convert gRPC metadata `<class 'grpc.aio._metadata.Metadata'>` to list of tuples
83
+ metadata = (
84
+ dict([(k, str(v)) for k, v in response_metadata])
85
+ if response_metadata
86
+ else None
87
+ )
88
+ result = response.result()
89
+ if isinstance(result, proto.Message):
90
+ response_payload = type(result).to_json(result)
91
+ elif isinstance(result, google.protobuf.message.Message):
92
+ response_payload = MessageToJson(result)
93
+ else:
94
+ response_payload = f"{type(result).__name__}: {pickle.dumps(result)}"
95
+ grpc_response = {
96
+ "payload": response_payload,
97
+ "metadata": metadata,
98
+ "status": "OK",
99
+ }
100
+ _LOGGER.debug(
101
+ f"Received response for {client_call_details.method}.",
102
+ extra={
103
+ "serviceName": "google.bigtable.v2.Bigtable",
104
+ "rpcName": client_call_details.method,
105
+ "response": grpc_response,
106
+ "metadata": grpc_response["metadata"],
107
+ },
108
+ )
109
+ return response
110
+
111
+
112
+ class BigtableGrpcTransport(BigtableTransport):
113
+ """gRPC backend transport for Bigtable.
114
+
115
+ Service for reading from and writing to existing Bigtable
116
+ tables.
117
+
118
+ This class defines the same methods as the primary client, so the
119
+ primary client can load the underlying transport implementation
120
+ and call it.
121
+
122
+ It sends protocol buffers over the wire using gRPC (which is built on
123
+ top of HTTP/2); the ``grpcio`` package must be installed.
124
+ """
125
+
126
+ _stubs: Dict[str, Callable]
127
+
128
+ def __init__(
129
+ self,
130
+ *,
131
+ host: str = "bigtable.googleapis.com",
132
+ credentials: Optional[ga_credentials.Credentials] = None,
133
+ credentials_file: Optional[str] = None,
134
+ scopes: Optional[Sequence[str]] = None,
135
+ channel: Optional[Union[grpc.Channel, Callable[..., grpc.Channel]]] = None,
136
+ api_mtls_endpoint: Optional[str] = None,
137
+ client_cert_source: Optional[Callable[[], Tuple[bytes, bytes]]] = None,
138
+ ssl_channel_credentials: Optional[grpc.ChannelCredentials] = None,
139
+ client_cert_source_for_mtls: Optional[Callable[[], Tuple[bytes, bytes]]] = None,
140
+ quota_project_id: Optional[str] = None,
141
+ client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO,
142
+ always_use_jwt_access: Optional[bool] = False,
143
+ api_audience: Optional[str] = None,
144
+ ) -> None:
145
+ """Instantiate the transport.
146
+
147
+ Args:
148
+ host (Optional[str]):
149
+ The hostname to connect to (default: 'bigtable.googleapis.com').
150
+ credentials (Optional[google.auth.credentials.Credentials]): The
151
+ authorization credentials to attach to requests. These
152
+ credentials identify the application to the service; if none
153
+ are specified, the client will attempt to ascertain the
154
+ credentials from the environment.
155
+ This argument is ignored if a ``channel`` instance is provided.
156
+ credentials_file (Optional[str]): A file with credentials that can
157
+ be loaded with :func:`google.auth.load_credentials_from_file`.
158
+ This argument is ignored if a ``channel`` instance is provided.
159
+ scopes (Optional(Sequence[str])): A list of scopes. This argument is
160
+ ignored if a ``channel`` instance is provided.
161
+ channel (Optional[Union[grpc.Channel, Callable[..., grpc.Channel]]]):
162
+ A ``Channel`` instance through which to make calls, or a Callable
163
+ that constructs and returns one. If set to None, ``self.create_channel``
164
+ is used to create the channel. If a Callable is given, it will be called
165
+ with the same arguments as used in ``self.create_channel``.
166
+ api_mtls_endpoint (Optional[str]): Deprecated. The mutual TLS endpoint.
167
+ If provided, it overrides the ``host`` argument and tries to create
168
+ a mutual TLS channel with client SSL credentials from
169
+ ``client_cert_source`` or application default SSL credentials.
170
+ client_cert_source (Optional[Callable[[], Tuple[bytes, bytes]]]):
171
+ Deprecated. A callback to provide client SSL certificate bytes and
172
+ private key bytes, both in PEM format. It is ignored if
173
+ ``api_mtls_endpoint`` is None.
174
+ ssl_channel_credentials (grpc.ChannelCredentials): SSL credentials
175
+ for the grpc channel. It is ignored if a ``channel`` instance is provided.
176
+ client_cert_source_for_mtls (Optional[Callable[[], Tuple[bytes, bytes]]]):
177
+ A callback to provide client certificate bytes and private key bytes,
178
+ both in PEM format. It is used to configure a mutual TLS channel. It is
179
+ ignored if a ``channel`` instance or ``ssl_channel_credentials`` is provided.
180
+ quota_project_id (Optional[str]): An optional project to use for billing
181
+ and quota.
182
+ client_info (google.api_core.gapic_v1.client_info.ClientInfo):
183
+ The client info used to send a user-agent string along with
184
+ API requests. If ``None``, then default info will be used.
185
+ Generally, you only need to set this if you're developing
186
+ your own client library.
187
+ always_use_jwt_access (Optional[bool]): Whether self signed JWT should
188
+ be used for service account credentials.
189
+
190
+ Raises:
191
+ google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport
192
+ creation failed for any reason.
193
+ google.api_core.exceptions.DuplicateCredentialArgs: If both ``credentials``
194
+ and ``credentials_file`` are passed.
195
+ """
196
+ self._grpc_channel = None
197
+ self._ssl_channel_credentials = ssl_channel_credentials
198
+ self._stubs: Dict[str, Callable] = {}
199
+
200
+ if api_mtls_endpoint:
201
+ warnings.warn("api_mtls_endpoint is deprecated", DeprecationWarning)
202
+ if client_cert_source:
203
+ warnings.warn("client_cert_source is deprecated", DeprecationWarning)
204
+
205
+ if isinstance(channel, grpc.Channel):
206
+ # Ignore credentials if a channel was passed.
207
+ credentials = None
208
+ self._ignore_credentials = True
209
+ # If a channel was explicitly provided, set it.
210
+ self._grpc_channel = channel
211
+ self._ssl_channel_credentials = None
212
+
213
+ else:
214
+ if api_mtls_endpoint:
215
+ host = api_mtls_endpoint
216
+
217
+ # Create SSL credentials with client_cert_source or application
218
+ # default SSL credentials.
219
+ if client_cert_source:
220
+ cert, key = client_cert_source()
221
+ self._ssl_channel_credentials = grpc.ssl_channel_credentials(
222
+ certificate_chain=cert, private_key=key
223
+ )
224
+ else:
225
+ self._ssl_channel_credentials = SslCredentials().ssl_credentials
226
+
227
+ else:
228
+ if client_cert_source_for_mtls and not ssl_channel_credentials:
229
+ cert, key = client_cert_source_for_mtls()
230
+ self._ssl_channel_credentials = grpc.ssl_channel_credentials(
231
+ certificate_chain=cert, private_key=key
232
+ )
233
+
234
+ # The base transport sets the host, credentials and scopes
235
+ super().__init__(
236
+ host=host,
237
+ credentials=credentials,
238
+ credentials_file=credentials_file,
239
+ scopes=scopes,
240
+ quota_project_id=quota_project_id,
241
+ client_info=client_info,
242
+ always_use_jwt_access=always_use_jwt_access,
243
+ api_audience=api_audience,
244
+ )
245
+
246
+ if not self._grpc_channel:
247
+ # initialize with the provided callable or the default channel
248
+ channel_init = channel or type(self).create_channel
249
+ self._grpc_channel = channel_init(
250
+ self._host,
251
+ # use the credentials which are saved
252
+ credentials=self._credentials,
253
+ # Set ``credentials_file`` to ``None`` here as
254
+ # the credentials that we saved earlier should be used.
255
+ credentials_file=None,
256
+ scopes=self._scopes,
257
+ ssl_credentials=self._ssl_channel_credentials,
258
+ quota_project_id=quota_project_id,
259
+ options=[
260
+ ("grpc.max_send_message_length", -1),
261
+ ("grpc.max_receive_message_length", -1),
262
+ ],
263
+ )
264
+
265
+ self._interceptor = _LoggingClientInterceptor()
266
+ self._logged_channel = grpc.intercept_channel(
267
+ self._grpc_channel, self._interceptor
268
+ )
269
+
270
+ # Wrap messages. This must be done after self._logged_channel exists
271
+ self._prep_wrapped_messages(client_info)
272
+
273
+ @classmethod
274
+ def create_channel(
275
+ cls,
276
+ host: str = "bigtable.googleapis.com",
277
+ credentials: Optional[ga_credentials.Credentials] = None,
278
+ credentials_file: Optional[str] = None,
279
+ scopes: Optional[Sequence[str]] = None,
280
+ quota_project_id: Optional[str] = None,
281
+ **kwargs,
282
+ ) -> grpc.Channel:
283
+ """Create and return a gRPC channel object.
284
+ Args:
285
+ host (Optional[str]): The host for the channel to use.
286
+ credentials (Optional[~.Credentials]): The
287
+ authorization credentials to attach to requests. These
288
+ credentials identify this application to the service. If
289
+ none are specified, the client will attempt to ascertain
290
+ the credentials from the environment.
291
+ credentials_file (Optional[str]): A file with credentials that can
292
+ be loaded with :func:`google.auth.load_credentials_from_file`.
293
+ This argument is mutually exclusive with credentials.
294
+ scopes (Optional[Sequence[str]]): A optional list of scopes needed for this
295
+ service. These are only used when credentials are not specified and
296
+ are passed to :func:`google.auth.default`.
297
+ quota_project_id (Optional[str]): An optional project to use for billing
298
+ and quota.
299
+ kwargs (Optional[dict]): Keyword arguments, which are passed to the
300
+ channel creation.
301
+ Returns:
302
+ grpc.Channel: A gRPC channel object.
303
+
304
+ Raises:
305
+ google.api_core.exceptions.DuplicateCredentialArgs: If both ``credentials``
306
+ and ``credentials_file`` are passed.
307
+ """
308
+
309
+ return grpc_helpers.create_channel(
310
+ host,
311
+ credentials=credentials,
312
+ credentials_file=credentials_file,
313
+ quota_project_id=quota_project_id,
314
+ default_scopes=cls.AUTH_SCOPES,
315
+ scopes=scopes,
316
+ default_host=cls.DEFAULT_HOST,
317
+ **kwargs,
318
+ )
319
+
320
+ @property
321
+ def grpc_channel(self) -> grpc.Channel:
322
+ """Return the channel designed to connect to this service."""
323
+ return self._grpc_channel
324
+
325
+ @property
326
+ def read_rows(
327
+ self,
328
+ ) -> Callable[[bigtable.ReadRowsRequest], bigtable.ReadRowsResponse]:
329
+ r"""Return a callable for the read rows method over gRPC.
330
+
331
+ Streams back the contents of all requested rows in
332
+ key order, optionally applying the same Reader filter to
333
+ each. Depending on their size, rows and cells may be
334
+ broken up across multiple responses, but atomicity of
335
+ each row will still be preserved. See the
336
+ ReadRowsResponse documentation for details.
337
+
338
+ Returns:
339
+ Callable[[~.ReadRowsRequest],
340
+ ~.ReadRowsResponse]:
341
+ A function that, when called, will call the underlying RPC
342
+ on the server.
343
+ """
344
+ # Generate a "stub function" on-the-fly which will actually make
345
+ # the request.
346
+ # gRPC handles serialization and deserialization, so we just need
347
+ # to pass in the functions for each.
348
+ if "read_rows" not in self._stubs:
349
+ self._stubs["read_rows"] = self._logged_channel.unary_stream(
350
+ "/google.bigtable.v2.Bigtable/ReadRows",
351
+ request_serializer=bigtable.ReadRowsRequest.serialize,
352
+ response_deserializer=bigtable.ReadRowsResponse.deserialize,
353
+ )
354
+ return self._stubs["read_rows"]
355
+
356
+ @property
357
+ def sample_row_keys(
358
+ self,
359
+ ) -> Callable[[bigtable.SampleRowKeysRequest], bigtable.SampleRowKeysResponse]:
360
+ r"""Return a callable for the sample row keys method over gRPC.
361
+
362
+ Returns a sample of row keys in the table. The
363
+ returned row keys will delimit contiguous sections of
364
+ the table of approximately equal size, which can be used
365
+ to break up the data for distributed tasks like
366
+ mapreduces.
367
+
368
+ Returns:
369
+ Callable[[~.SampleRowKeysRequest],
370
+ ~.SampleRowKeysResponse]:
371
+ A function that, when called, will call the underlying RPC
372
+ on the server.
373
+ """
374
+ # Generate a "stub function" on-the-fly which will actually make
375
+ # the request.
376
+ # gRPC handles serialization and deserialization, so we just need
377
+ # to pass in the functions for each.
378
+ if "sample_row_keys" not in self._stubs:
379
+ self._stubs["sample_row_keys"] = self._logged_channel.unary_stream(
380
+ "/google.bigtable.v2.Bigtable/SampleRowKeys",
381
+ request_serializer=bigtable.SampleRowKeysRequest.serialize,
382
+ response_deserializer=bigtable.SampleRowKeysResponse.deserialize,
383
+ )
384
+ return self._stubs["sample_row_keys"]
385
+
386
+ @property
387
+ def mutate_row(
388
+ self,
389
+ ) -> Callable[[bigtable.MutateRowRequest], bigtable.MutateRowResponse]:
390
+ r"""Return a callable for the mutate row method over gRPC.
391
+
392
+ Mutates a row atomically. Cells already present in the row are
393
+ left unchanged unless explicitly changed by ``mutation``.
394
+
395
+ Returns:
396
+ Callable[[~.MutateRowRequest],
397
+ ~.MutateRowResponse]:
398
+ A function that, when called, will call the underlying RPC
399
+ on the server.
400
+ """
401
+ # Generate a "stub function" on-the-fly which will actually make
402
+ # the request.
403
+ # gRPC handles serialization and deserialization, so we just need
404
+ # to pass in the functions for each.
405
+ if "mutate_row" not in self._stubs:
406
+ self._stubs["mutate_row"] = self._logged_channel.unary_unary(
407
+ "/google.bigtable.v2.Bigtable/MutateRow",
408
+ request_serializer=bigtable.MutateRowRequest.serialize,
409
+ response_deserializer=bigtable.MutateRowResponse.deserialize,
410
+ )
411
+ return self._stubs["mutate_row"]
412
+
413
+ @property
414
+ def mutate_rows(
415
+ self,
416
+ ) -> Callable[[bigtable.MutateRowsRequest], bigtable.MutateRowsResponse]:
417
+ r"""Return a callable for the mutate rows method over gRPC.
418
+
419
+ Mutates multiple rows in a batch. Each individual row
420
+ is mutated atomically as in MutateRow, but the entire
421
+ batch is not executed atomically.
422
+
423
+ Returns:
424
+ Callable[[~.MutateRowsRequest],
425
+ ~.MutateRowsResponse]:
426
+ A function that, when called, will call the underlying RPC
427
+ on the server.
428
+ """
429
+ # Generate a "stub function" on-the-fly which will actually make
430
+ # the request.
431
+ # gRPC handles serialization and deserialization, so we just need
432
+ # to pass in the functions for each.
433
+ if "mutate_rows" not in self._stubs:
434
+ self._stubs["mutate_rows"] = self._logged_channel.unary_stream(
435
+ "/google.bigtable.v2.Bigtable/MutateRows",
436
+ request_serializer=bigtable.MutateRowsRequest.serialize,
437
+ response_deserializer=bigtable.MutateRowsResponse.deserialize,
438
+ )
439
+ return self._stubs["mutate_rows"]
440
+
441
+ @property
442
+ def check_and_mutate_row(
443
+ self,
444
+ ) -> Callable[
445
+ [bigtable.CheckAndMutateRowRequest], bigtable.CheckAndMutateRowResponse
446
+ ]:
447
+ r"""Return a callable for the check and mutate row method over gRPC.
448
+
449
+ Mutates a row atomically based on the output of a
450
+ predicate Reader filter.
451
+
452
+ Returns:
453
+ Callable[[~.CheckAndMutateRowRequest],
454
+ ~.CheckAndMutateRowResponse]:
455
+ A function that, when called, will call the underlying RPC
456
+ on the server.
457
+ """
458
+ # Generate a "stub function" on-the-fly which will actually make
459
+ # the request.
460
+ # gRPC handles serialization and deserialization, so we just need
461
+ # to pass in the functions for each.
462
+ if "check_and_mutate_row" not in self._stubs:
463
+ self._stubs["check_and_mutate_row"] = self._logged_channel.unary_unary(
464
+ "/google.bigtable.v2.Bigtable/CheckAndMutateRow",
465
+ request_serializer=bigtable.CheckAndMutateRowRequest.serialize,
466
+ response_deserializer=bigtable.CheckAndMutateRowResponse.deserialize,
467
+ )
468
+ return self._stubs["check_and_mutate_row"]
469
+
470
+ @property
471
+ def ping_and_warm(
472
+ self,
473
+ ) -> Callable[[bigtable.PingAndWarmRequest], bigtable.PingAndWarmResponse]:
474
+ r"""Return a callable for the ping and warm method over gRPC.
475
+
476
+ Warm up associated instance metadata for this
477
+ connection. This call is not required but may be useful
478
+ for connection keep-alive.
479
+
480
+ Returns:
481
+ Callable[[~.PingAndWarmRequest],
482
+ ~.PingAndWarmResponse]:
483
+ A function that, when called, will call the underlying RPC
484
+ on the server.
485
+ """
486
+ # Generate a "stub function" on-the-fly which will actually make
487
+ # the request.
488
+ # gRPC handles serialization and deserialization, so we just need
489
+ # to pass in the functions for each.
490
+ if "ping_and_warm" not in self._stubs:
491
+ self._stubs["ping_and_warm"] = self._logged_channel.unary_unary(
492
+ "/google.bigtable.v2.Bigtable/PingAndWarm",
493
+ request_serializer=bigtable.PingAndWarmRequest.serialize,
494
+ response_deserializer=bigtable.PingAndWarmResponse.deserialize,
495
+ )
496
+ return self._stubs["ping_and_warm"]
497
+
498
+ @property
499
+ def read_modify_write_row(
500
+ self,
501
+ ) -> Callable[
502
+ [bigtable.ReadModifyWriteRowRequest], bigtable.ReadModifyWriteRowResponse
503
+ ]:
504
+ r"""Return a callable for the read modify write row method over gRPC.
505
+
506
+ Modifies a row atomically on the server. The method
507
+ reads the latest existing timestamp and value from the
508
+ specified columns and writes a new entry based on
509
+ pre-defined read/modify/write rules. The new value for
510
+ the timestamp is the greater of the existing timestamp
511
+ or the current server time. The method returns the new
512
+ contents of all modified cells.
513
+
514
+ Returns:
515
+ Callable[[~.ReadModifyWriteRowRequest],
516
+ ~.ReadModifyWriteRowResponse]:
517
+ A function that, when called, will call the underlying RPC
518
+ on the server.
519
+ """
520
+ # Generate a "stub function" on-the-fly which will actually make
521
+ # the request.
522
+ # gRPC handles serialization and deserialization, so we just need
523
+ # to pass in the functions for each.
524
+ if "read_modify_write_row" not in self._stubs:
525
+ self._stubs["read_modify_write_row"] = self._logged_channel.unary_unary(
526
+ "/google.bigtable.v2.Bigtable/ReadModifyWriteRow",
527
+ request_serializer=bigtable.ReadModifyWriteRowRequest.serialize,
528
+ response_deserializer=bigtable.ReadModifyWriteRowResponse.deserialize,
529
+ )
530
+ return self._stubs["read_modify_write_row"]
531
+
532
+ @property
533
+ def generate_initial_change_stream_partitions(
534
+ self,
535
+ ) -> Callable[
536
+ [bigtable.GenerateInitialChangeStreamPartitionsRequest],
537
+ bigtable.GenerateInitialChangeStreamPartitionsResponse,
538
+ ]:
539
+ r"""Return a callable for the generate initial change stream
540
+ partitions method over gRPC.
541
+
542
+ NOTE: This API is intended to be used by Apache Beam BigtableIO.
543
+ Returns the current list of partitions that make up the table's
544
+ change stream. The union of partitions will cover the entire
545
+ keyspace. Partitions can be read with ``ReadChangeStream``.
546
+
547
+ Returns:
548
+ Callable[[~.GenerateInitialChangeStreamPartitionsRequest],
549
+ ~.GenerateInitialChangeStreamPartitionsResponse]:
550
+ A function that, when called, will call the underlying RPC
551
+ on the server.
552
+ """
553
+ # Generate a "stub function" on-the-fly which will actually make
554
+ # the request.
555
+ # gRPC handles serialization and deserialization, so we just need
556
+ # to pass in the functions for each.
557
+ if "generate_initial_change_stream_partitions" not in self._stubs:
558
+ self._stubs[
559
+ "generate_initial_change_stream_partitions"
560
+ ] = self._logged_channel.unary_stream(
561
+ "/google.bigtable.v2.Bigtable/GenerateInitialChangeStreamPartitions",
562
+ request_serializer=bigtable.GenerateInitialChangeStreamPartitionsRequest.serialize,
563
+ response_deserializer=bigtable.GenerateInitialChangeStreamPartitionsResponse.deserialize,
564
+ )
565
+ return self._stubs["generate_initial_change_stream_partitions"]
566
+
567
+ @property
568
+ def read_change_stream(
569
+ self,
570
+ ) -> Callable[
571
+ [bigtable.ReadChangeStreamRequest], bigtable.ReadChangeStreamResponse
572
+ ]:
573
+ r"""Return a callable for the read change stream method over gRPC.
574
+
575
+ NOTE: This API is intended to be used by Apache Beam
576
+ BigtableIO. Reads changes from a table's change stream.
577
+ Changes will reflect both user-initiated mutations and
578
+ mutations that are caused by garbage collection.
579
+
580
+ Returns:
581
+ Callable[[~.ReadChangeStreamRequest],
582
+ ~.ReadChangeStreamResponse]:
583
+ A function that, when called, will call the underlying RPC
584
+ on the server.
585
+ """
586
+ # Generate a "stub function" on-the-fly which will actually make
587
+ # the request.
588
+ # gRPC handles serialization and deserialization, so we just need
589
+ # to pass in the functions for each.
590
+ if "read_change_stream" not in self._stubs:
591
+ self._stubs["read_change_stream"] = self._logged_channel.unary_stream(
592
+ "/google.bigtable.v2.Bigtable/ReadChangeStream",
593
+ request_serializer=bigtable.ReadChangeStreamRequest.serialize,
594
+ response_deserializer=bigtable.ReadChangeStreamResponse.deserialize,
595
+ )
596
+ return self._stubs["read_change_stream"]
597
+
598
+ @property
599
+ def prepare_query(
600
+ self,
601
+ ) -> Callable[[bigtable.PrepareQueryRequest], bigtable.PrepareQueryResponse]:
602
+ r"""Return a callable for the prepare query method over gRPC.
603
+
604
+ Prepares a GoogleSQL query for execution on a
605
+ particular Bigtable instance.
606
+
607
+ Returns:
608
+ Callable[[~.PrepareQueryRequest],
609
+ ~.PrepareQueryResponse]:
610
+ A function that, when called, will call the underlying RPC
611
+ on the server.
612
+ """
613
+ # Generate a "stub function" on-the-fly which will actually make
614
+ # the request.
615
+ # gRPC handles serialization and deserialization, so we just need
616
+ # to pass in the functions for each.
617
+ if "prepare_query" not in self._stubs:
618
+ self._stubs["prepare_query"] = self._logged_channel.unary_unary(
619
+ "/google.bigtable.v2.Bigtable/PrepareQuery",
620
+ request_serializer=bigtable.PrepareQueryRequest.serialize,
621
+ response_deserializer=bigtable.PrepareQueryResponse.deserialize,
622
+ )
623
+ return self._stubs["prepare_query"]
624
+
625
+ @property
626
+ def execute_query(
627
+ self,
628
+ ) -> Callable[[bigtable.ExecuteQueryRequest], bigtable.ExecuteQueryResponse]:
629
+ r"""Return a callable for the execute query method over gRPC.
630
+
631
+ Executes a SQL query against a particular Bigtable
632
+ instance.
633
+
634
+ Returns:
635
+ Callable[[~.ExecuteQueryRequest],
636
+ ~.ExecuteQueryResponse]:
637
+ A function that, when called, will call the underlying RPC
638
+ on the server.
639
+ """
640
+ # Generate a "stub function" on-the-fly which will actually make
641
+ # the request.
642
+ # gRPC handles serialization and deserialization, so we just need
643
+ # to pass in the functions for each.
644
+ if "execute_query" not in self._stubs:
645
+ self._stubs["execute_query"] = self._logged_channel.unary_stream(
646
+ "/google.bigtable.v2.Bigtable/ExecuteQuery",
647
+ request_serializer=bigtable.ExecuteQueryRequest.serialize,
648
+ response_deserializer=bigtable.ExecuteQueryResponse.deserialize,
649
+ )
650
+ return self._stubs["execute_query"]
651
+
652
+ def close(self):
653
+ self._logged_channel.close()
654
+
655
+ @property
656
+ def kind(self) -> str:
657
+ return "grpc"
658
+
659
+
660
+ __all__ = ("BigtableGrpcTransport",)