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,38 @@
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
+ from collections import OrderedDict
17
+ from typing import Dict, Type
18
+
19
+ from .base import BigtableTransport
20
+ from .grpc import BigtableGrpcTransport
21
+ from .grpc_asyncio import BigtableGrpcAsyncIOTransport
22
+ from .rest import BigtableRestTransport
23
+ from .rest import BigtableRestInterceptor
24
+
25
+
26
+ # Compile a registry of transports.
27
+ _transport_registry = OrderedDict() # type: Dict[str, Type[BigtableTransport]]
28
+ _transport_registry["grpc"] = BigtableGrpcTransport
29
+ _transport_registry["grpc_asyncio"] = BigtableGrpcAsyncIOTransport
30
+ _transport_registry["rest"] = BigtableRestTransport
31
+
32
+ __all__ = (
33
+ "BigtableTransport",
34
+ "BigtableGrpcTransport",
35
+ "BigtableGrpcAsyncIOTransport",
36
+ "BigtableRestTransport",
37
+ "BigtableRestInterceptor",
38
+ )
@@ -0,0 +1,343 @@
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 abc
17
+ from typing import Awaitable, Callable, Dict, Optional, Sequence, Union
18
+
19
+ from google.cloud.bigtable_v2 import gapic_version as package_version
20
+
21
+ import google.auth # type: ignore
22
+ import google.api_core
23
+ from google.api_core import exceptions as core_exceptions
24
+ from google.api_core import gapic_v1
25
+ from google.api_core import retry as retries
26
+ from google.auth import credentials as ga_credentials # type: ignore
27
+ from google.oauth2 import service_account # type: ignore
28
+
29
+ from google.cloud.bigtable_v2.types import bigtable
30
+
31
+ DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo(
32
+ gapic_version=package_version.__version__
33
+ )
34
+
35
+
36
+ class BigtableTransport(abc.ABC):
37
+ """Abstract transport class for Bigtable."""
38
+
39
+ AUTH_SCOPES = (
40
+ "https://www.googleapis.com/auth/bigtable.data",
41
+ "https://www.googleapis.com/auth/bigtable.data.readonly",
42
+ "https://www.googleapis.com/auth/cloud-bigtable.data",
43
+ "https://www.googleapis.com/auth/cloud-bigtable.data.readonly",
44
+ "https://www.googleapis.com/auth/cloud-platform",
45
+ "https://www.googleapis.com/auth/cloud-platform.read-only",
46
+ )
47
+
48
+ DEFAULT_HOST: str = "bigtable.googleapis.com"
49
+
50
+ def __init__(
51
+ self,
52
+ *,
53
+ host: str = DEFAULT_HOST,
54
+ credentials: Optional[ga_credentials.Credentials] = None,
55
+ credentials_file: Optional[str] = None,
56
+ scopes: Optional[Sequence[str]] = None,
57
+ quota_project_id: Optional[str] = None,
58
+ client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO,
59
+ always_use_jwt_access: Optional[bool] = False,
60
+ api_audience: Optional[str] = None,
61
+ **kwargs,
62
+ ) -> None:
63
+ """Instantiate the transport.
64
+
65
+ Args:
66
+ host (Optional[str]):
67
+ The hostname to connect to (default: 'bigtable.googleapis.com').
68
+ credentials (Optional[google.auth.credentials.Credentials]): The
69
+ authorization credentials to attach to requests. These
70
+ credentials identify the application to the service; if none
71
+ are specified, the client will attempt to ascertain the
72
+ credentials from the environment.
73
+ credentials_file (Optional[str]): A file with credentials that can
74
+ be loaded with :func:`google.auth.load_credentials_from_file`.
75
+ This argument is mutually exclusive with credentials.
76
+ scopes (Optional[Sequence[str]]): A list of scopes.
77
+ quota_project_id (Optional[str]): An optional project to use for billing
78
+ and quota.
79
+ client_info (google.api_core.gapic_v1.client_info.ClientInfo):
80
+ The client info used to send a user-agent string along with
81
+ API requests. If ``None``, then default info will be used.
82
+ Generally, you only need to set this if you're developing
83
+ your own client library.
84
+ always_use_jwt_access (Optional[bool]): Whether self signed JWT should
85
+ be used for service account credentials.
86
+ """
87
+
88
+ scopes_kwargs = {"scopes": scopes, "default_scopes": self.AUTH_SCOPES}
89
+
90
+ # Save the scopes.
91
+ self._scopes = scopes
92
+ if not hasattr(self, "_ignore_credentials"):
93
+ self._ignore_credentials: bool = False
94
+
95
+ # If no credentials are provided, then determine the appropriate
96
+ # defaults.
97
+ if credentials and credentials_file:
98
+ raise core_exceptions.DuplicateCredentialArgs(
99
+ "'credentials_file' and 'credentials' are mutually exclusive"
100
+ )
101
+
102
+ if credentials_file is not None:
103
+ credentials, _ = google.auth.load_credentials_from_file(
104
+ credentials_file, **scopes_kwargs, quota_project_id=quota_project_id
105
+ )
106
+ elif credentials is None and not self._ignore_credentials:
107
+ credentials, _ = google.auth.default(
108
+ **scopes_kwargs, quota_project_id=quota_project_id
109
+ )
110
+ # Don't apply audience if the credentials file passed from user.
111
+ if hasattr(credentials, "with_gdch_audience"):
112
+ credentials = credentials.with_gdch_audience(
113
+ api_audience if api_audience else host
114
+ )
115
+
116
+ # If the credentials are service account credentials, then always try to use self signed JWT.
117
+ if (
118
+ always_use_jwt_access
119
+ and isinstance(credentials, service_account.Credentials)
120
+ and hasattr(service_account.Credentials, "with_always_use_jwt_access")
121
+ ):
122
+ credentials = credentials.with_always_use_jwt_access(True)
123
+
124
+ # Save the credentials.
125
+ self._credentials = credentials
126
+
127
+ # Save the hostname. Default to port 443 (HTTPS) if none is specified.
128
+ if ":" not in host:
129
+ host += ":443"
130
+ self._host = host
131
+
132
+ @property
133
+ def host(self):
134
+ return self._host
135
+
136
+ def _prep_wrapped_messages(self, client_info):
137
+ # Precompute the wrapped methods.
138
+ self._wrapped_methods = {
139
+ self.read_rows: gapic_v1.method.wrap_method(
140
+ self.read_rows,
141
+ default_timeout=43200.0,
142
+ client_info=client_info,
143
+ ),
144
+ self.sample_row_keys: gapic_v1.method.wrap_method(
145
+ self.sample_row_keys,
146
+ default_timeout=60.0,
147
+ client_info=client_info,
148
+ ),
149
+ self.mutate_row: gapic_v1.method.wrap_method(
150
+ self.mutate_row,
151
+ default_retry=retries.Retry(
152
+ initial=0.01,
153
+ maximum=60.0,
154
+ multiplier=2,
155
+ predicate=retries.if_exception_type(
156
+ core_exceptions.DeadlineExceeded,
157
+ core_exceptions.ServiceUnavailable,
158
+ ),
159
+ deadline=60.0,
160
+ ),
161
+ default_timeout=60.0,
162
+ client_info=client_info,
163
+ ),
164
+ self.mutate_rows: gapic_v1.method.wrap_method(
165
+ self.mutate_rows,
166
+ default_timeout=600.0,
167
+ client_info=client_info,
168
+ ),
169
+ self.check_and_mutate_row: gapic_v1.method.wrap_method(
170
+ self.check_and_mutate_row,
171
+ default_timeout=20.0,
172
+ client_info=client_info,
173
+ ),
174
+ self.ping_and_warm: gapic_v1.method.wrap_method(
175
+ self.ping_and_warm,
176
+ default_timeout=None,
177
+ client_info=client_info,
178
+ ),
179
+ self.read_modify_write_row: gapic_v1.method.wrap_method(
180
+ self.read_modify_write_row,
181
+ default_timeout=20.0,
182
+ client_info=client_info,
183
+ ),
184
+ self.generate_initial_change_stream_partitions: gapic_v1.method.wrap_method(
185
+ self.generate_initial_change_stream_partitions,
186
+ default_timeout=60.0,
187
+ client_info=client_info,
188
+ ),
189
+ self.read_change_stream: gapic_v1.method.wrap_method(
190
+ self.read_change_stream,
191
+ default_timeout=43200.0,
192
+ client_info=client_info,
193
+ ),
194
+ self.prepare_query: gapic_v1.method.wrap_method(
195
+ self.prepare_query,
196
+ default_timeout=None,
197
+ client_info=client_info,
198
+ ),
199
+ self.execute_query: gapic_v1.method.wrap_method(
200
+ self.execute_query,
201
+ default_retry=retries.Retry(
202
+ initial=0.01,
203
+ maximum=60.0,
204
+ multiplier=2,
205
+ predicate=retries.if_exception_type(
206
+ core_exceptions.DeadlineExceeded,
207
+ core_exceptions.ServiceUnavailable,
208
+ ),
209
+ deadline=43200.0,
210
+ ),
211
+ default_timeout=43200.0,
212
+ client_info=client_info,
213
+ ),
214
+ }
215
+
216
+ def close(self):
217
+ """Closes resources associated with the transport.
218
+
219
+ .. warning::
220
+ Only call this method if the transport is NOT shared
221
+ with other clients - this may cause errors in other clients!
222
+ """
223
+ raise NotImplementedError()
224
+
225
+ @property
226
+ def read_rows(
227
+ self,
228
+ ) -> Callable[
229
+ [bigtable.ReadRowsRequest],
230
+ Union[bigtable.ReadRowsResponse, Awaitable[bigtable.ReadRowsResponse]],
231
+ ]:
232
+ raise NotImplementedError()
233
+
234
+ @property
235
+ def sample_row_keys(
236
+ self,
237
+ ) -> Callable[
238
+ [bigtable.SampleRowKeysRequest],
239
+ Union[
240
+ bigtable.SampleRowKeysResponse, Awaitable[bigtable.SampleRowKeysResponse]
241
+ ],
242
+ ]:
243
+ raise NotImplementedError()
244
+
245
+ @property
246
+ def mutate_row(
247
+ self,
248
+ ) -> Callable[
249
+ [bigtable.MutateRowRequest],
250
+ Union[bigtable.MutateRowResponse, Awaitable[bigtable.MutateRowResponse]],
251
+ ]:
252
+ raise NotImplementedError()
253
+
254
+ @property
255
+ def mutate_rows(
256
+ self,
257
+ ) -> Callable[
258
+ [bigtable.MutateRowsRequest],
259
+ Union[bigtable.MutateRowsResponse, Awaitable[bigtable.MutateRowsResponse]],
260
+ ]:
261
+ raise NotImplementedError()
262
+
263
+ @property
264
+ def check_and_mutate_row(
265
+ self,
266
+ ) -> Callable[
267
+ [bigtable.CheckAndMutateRowRequest],
268
+ Union[
269
+ bigtable.CheckAndMutateRowResponse,
270
+ Awaitable[bigtable.CheckAndMutateRowResponse],
271
+ ],
272
+ ]:
273
+ raise NotImplementedError()
274
+
275
+ @property
276
+ def ping_and_warm(
277
+ self,
278
+ ) -> Callable[
279
+ [bigtable.PingAndWarmRequest],
280
+ Union[bigtable.PingAndWarmResponse, Awaitable[bigtable.PingAndWarmResponse]],
281
+ ]:
282
+ raise NotImplementedError()
283
+
284
+ @property
285
+ def read_modify_write_row(
286
+ self,
287
+ ) -> Callable[
288
+ [bigtable.ReadModifyWriteRowRequest],
289
+ Union[
290
+ bigtable.ReadModifyWriteRowResponse,
291
+ Awaitable[bigtable.ReadModifyWriteRowResponse],
292
+ ],
293
+ ]:
294
+ raise NotImplementedError()
295
+
296
+ @property
297
+ def generate_initial_change_stream_partitions(
298
+ self,
299
+ ) -> Callable[
300
+ [bigtable.GenerateInitialChangeStreamPartitionsRequest],
301
+ Union[
302
+ bigtable.GenerateInitialChangeStreamPartitionsResponse,
303
+ Awaitable[bigtable.GenerateInitialChangeStreamPartitionsResponse],
304
+ ],
305
+ ]:
306
+ raise NotImplementedError()
307
+
308
+ @property
309
+ def read_change_stream(
310
+ self,
311
+ ) -> Callable[
312
+ [bigtable.ReadChangeStreamRequest],
313
+ Union[
314
+ bigtable.ReadChangeStreamResponse,
315
+ Awaitable[bigtable.ReadChangeStreamResponse],
316
+ ],
317
+ ]:
318
+ raise NotImplementedError()
319
+
320
+ @property
321
+ def prepare_query(
322
+ self,
323
+ ) -> Callable[
324
+ [bigtable.PrepareQueryRequest],
325
+ Union[bigtable.PrepareQueryResponse, Awaitable[bigtable.PrepareQueryResponse]],
326
+ ]:
327
+ raise NotImplementedError()
328
+
329
+ @property
330
+ def execute_query(
331
+ self,
332
+ ) -> Callable[
333
+ [bigtable.ExecuteQueryRequest],
334
+ Union[bigtable.ExecuteQueryResponse, Awaitable[bigtable.ExecuteQueryResponse]],
335
+ ]:
336
+ raise NotImplementedError()
337
+
338
+ @property
339
+ def kind(self) -> str:
340
+ raise NotImplementedError()
341
+
342
+
343
+ __all__ = ("BigtableTransport",)