google-cloud-bigquery 3.31.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 (58) hide show
  1. google/cloud/bigquery/__init__.py +249 -0
  2. google/cloud/bigquery/_helpers.py +1102 -0
  3. google/cloud/bigquery/_http.py +47 -0
  4. google/cloud/bigquery/_job_helpers.py +600 -0
  5. google/cloud/bigquery/_pandas_helpers.py +1181 -0
  6. google/cloud/bigquery/_pyarrow_helpers.py +147 -0
  7. google/cloud/bigquery/_tqdm_helpers.py +137 -0
  8. google/cloud/bigquery/_versions_helpers.py +264 -0
  9. google/cloud/bigquery/client.py +4406 -0
  10. google/cloud/bigquery/dataset.py +1076 -0
  11. google/cloud/bigquery/dbapi/__init__.py +87 -0
  12. google/cloud/bigquery/dbapi/_helpers.py +522 -0
  13. google/cloud/bigquery/dbapi/connection.py +128 -0
  14. google/cloud/bigquery/dbapi/cursor.py +586 -0
  15. google/cloud/bigquery/dbapi/exceptions.py +58 -0
  16. google/cloud/bigquery/dbapi/types.py +96 -0
  17. google/cloud/bigquery/encryption_configuration.py +84 -0
  18. google/cloud/bigquery/enums.py +389 -0
  19. google/cloud/bigquery/exceptions.py +35 -0
  20. google/cloud/bigquery/external_config.py +1188 -0
  21. google/cloud/bigquery/format_options.py +147 -0
  22. google/cloud/bigquery/iam.py +38 -0
  23. google/cloud/bigquery/job/__init__.py +87 -0
  24. google/cloud/bigquery/job/base.py +1116 -0
  25. google/cloud/bigquery/job/copy_.py +282 -0
  26. google/cloud/bigquery/job/extract.py +271 -0
  27. google/cloud/bigquery/job/load.py +985 -0
  28. google/cloud/bigquery/job/query.py +2498 -0
  29. google/cloud/bigquery/magics/__init__.py +20 -0
  30. google/cloud/bigquery/magics/line_arg_parser/__init__.py +34 -0
  31. google/cloud/bigquery/magics/line_arg_parser/exceptions.py +25 -0
  32. google/cloud/bigquery/magics/line_arg_parser/lexer.py +200 -0
  33. google/cloud/bigquery/magics/line_arg_parser/parser.py +484 -0
  34. google/cloud/bigquery/magics/line_arg_parser/visitors.py +159 -0
  35. google/cloud/bigquery/magics/magics.py +776 -0
  36. google/cloud/bigquery/model.py +517 -0
  37. google/cloud/bigquery/opentelemetry_tracing.py +164 -0
  38. google/cloud/bigquery/py.typed +2 -0
  39. google/cloud/bigquery/query.py +1344 -0
  40. google/cloud/bigquery/retry.py +207 -0
  41. google/cloud/bigquery/routine/__init__.py +33 -0
  42. google/cloud/bigquery/routine/routine.py +744 -0
  43. google/cloud/bigquery/schema.py +896 -0
  44. google/cloud/bigquery/standard_sql.py +389 -0
  45. google/cloud/bigquery/table.py +3594 -0
  46. google/cloud/bigquery/version.py +15 -0
  47. google/cloud/bigquery_v2/__init__.py +56 -0
  48. google/cloud/bigquery_v2/types/__init__.py +54 -0
  49. google/cloud/bigquery_v2/types/encryption_config.py +48 -0
  50. google/cloud/bigquery_v2/types/model.py +1994 -0
  51. google/cloud/bigquery_v2/types/model_reference.py +57 -0
  52. google/cloud/bigquery_v2/types/standard_sql.py +156 -0
  53. google/cloud/bigquery_v2/types/table_reference.py +80 -0
  54. google_cloud_bigquery-3.31.0.dist-info/LICENSE +202 -0
  55. google_cloud_bigquery-3.31.0.dist-info/METADATA +203 -0
  56. google_cloud_bigquery-3.31.0.dist-info/RECORD +58 -0
  57. google_cloud_bigquery-3.31.0.dist-info/WHEEL +5 -0
  58. google_cloud_bigquery-3.31.0.dist-info/top_level.txt +1 -0
@@ -0,0 +1,249 @@
1
+ # Copyright 2015 Google LLC
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
15
+ """Google BigQuery API wrapper.
16
+
17
+ The main concepts with this API are:
18
+
19
+ - :class:`~google.cloud.bigquery.client.Client` manages connections to the
20
+ BigQuery API. Use the client methods to run jobs (such as a
21
+ :class:`~google.cloud.bigquery.job.QueryJob` via
22
+ :meth:`~google.cloud.bigquery.client.Client.query`) and manage resources.
23
+
24
+ - :class:`~google.cloud.bigquery.dataset.Dataset` represents a
25
+ collection of tables.
26
+
27
+ - :class:`~google.cloud.bigquery.table.Table` represents a single "relation".
28
+ """
29
+
30
+ import warnings
31
+
32
+ from google.cloud.bigquery import version as bigquery_version
33
+
34
+ __version__ = bigquery_version.__version__
35
+
36
+ from google.cloud.bigquery.client import Client
37
+ from google.cloud.bigquery.dataset import AccessEntry
38
+ from google.cloud.bigquery.dataset import Dataset
39
+ from google.cloud.bigquery.dataset import DatasetReference
40
+ from google.cloud.bigquery import enums
41
+ from google.cloud.bigquery.enums import AutoRowIDs
42
+ from google.cloud.bigquery.enums import DecimalTargetType
43
+ from google.cloud.bigquery.enums import KeyResultStatementKind
44
+ from google.cloud.bigquery.enums import SqlTypeNames
45
+ from google.cloud.bigquery.enums import StandardSqlTypeNames
46
+ from google.cloud.bigquery.exceptions import LegacyBigQueryStorageError
47
+ from google.cloud.bigquery.exceptions import LegacyPandasError
48
+ from google.cloud.bigquery.exceptions import LegacyPyarrowError
49
+ from google.cloud.bigquery.external_config import ExternalConfig
50
+ from google.cloud.bigquery.external_config import BigtableOptions
51
+ from google.cloud.bigquery.external_config import BigtableColumnFamily
52
+ from google.cloud.bigquery.external_config import BigtableColumn
53
+ from google.cloud.bigquery.external_config import CSVOptions
54
+ from google.cloud.bigquery.external_config import GoogleSheetsOptions
55
+ from google.cloud.bigquery.external_config import ExternalSourceFormat
56
+ from google.cloud.bigquery.external_config import HivePartitioningOptions
57
+ from google.cloud.bigquery.format_options import AvroOptions
58
+ from google.cloud.bigquery.format_options import ParquetOptions
59
+ from google.cloud.bigquery.job.base import SessionInfo
60
+ from google.cloud.bigquery.job import Compression
61
+ from google.cloud.bigquery.job import CopyJob
62
+ from google.cloud.bigquery.job import CopyJobConfig
63
+ from google.cloud.bigquery.job import CreateDisposition
64
+ from google.cloud.bigquery.job import DestinationFormat
65
+ from google.cloud.bigquery.job import DmlStats
66
+ from google.cloud.bigquery.job import Encoding
67
+ from google.cloud.bigquery.job import ExtractJob
68
+ from google.cloud.bigquery.job import ExtractJobConfig
69
+ from google.cloud.bigquery.job import LoadJob
70
+ from google.cloud.bigquery.job import LoadJobConfig
71
+ from google.cloud.bigquery.job import OperationType
72
+ from google.cloud.bigquery.job import QueryJob
73
+ from google.cloud.bigquery.job import QueryJobConfig
74
+ from google.cloud.bigquery.job import QueryPriority
75
+ from google.cloud.bigquery.job import SchemaUpdateOption
76
+ from google.cloud.bigquery.job import ScriptOptions
77
+ from google.cloud.bigquery.job import SourceFormat
78
+ from google.cloud.bigquery.job import UnknownJob
79
+ from google.cloud.bigquery.job import TransactionInfo
80
+ from google.cloud.bigquery.job import WriteDisposition
81
+ from google.cloud.bigquery.model import Model
82
+ from google.cloud.bigquery.model import ModelReference
83
+ from google.cloud.bigquery.query import ArrayQueryParameter
84
+ from google.cloud.bigquery.query import ArrayQueryParameterType
85
+ from google.cloud.bigquery.query import ConnectionProperty
86
+ from google.cloud.bigquery.query import ScalarQueryParameter
87
+ from google.cloud.bigquery.query import ScalarQueryParameterType
88
+ from google.cloud.bigquery.query import RangeQueryParameter
89
+ from google.cloud.bigquery.query import RangeQueryParameterType
90
+ from google.cloud.bigquery.query import SqlParameterScalarTypes
91
+ from google.cloud.bigquery.query import StructQueryParameter
92
+ from google.cloud.bigquery.query import StructQueryParameterType
93
+ from google.cloud.bigquery.query import UDFResource
94
+ from google.cloud.bigquery.retry import DEFAULT_RETRY
95
+ from google.cloud.bigquery.routine import DeterminismLevel
96
+ from google.cloud.bigquery.routine import Routine
97
+ from google.cloud.bigquery.routine import RoutineArgument
98
+ from google.cloud.bigquery.routine import RoutineReference
99
+ from google.cloud.bigquery.routine import RoutineType
100
+ from google.cloud.bigquery.routine import RemoteFunctionOptions
101
+ from google.cloud.bigquery.schema import PolicyTagList
102
+ from google.cloud.bigquery.schema import SchemaField
103
+ from google.cloud.bigquery.schema import FieldElementType
104
+ from google.cloud.bigquery.standard_sql import StandardSqlDataType
105
+ from google.cloud.bigquery.standard_sql import StandardSqlField
106
+ from google.cloud.bigquery.standard_sql import StandardSqlStructType
107
+ from google.cloud.bigquery.standard_sql import StandardSqlTableType
108
+ from google.cloud.bigquery.table import PartitionRange
109
+ from google.cloud.bigquery.table import RangePartitioning
110
+ from google.cloud.bigquery.table import Row
111
+ from google.cloud.bigquery.table import SnapshotDefinition
112
+ from google.cloud.bigquery.table import CloneDefinition
113
+ from google.cloud.bigquery.table import Table
114
+ from google.cloud.bigquery.table import TableReference
115
+ from google.cloud.bigquery.table import TimePartitioningType
116
+ from google.cloud.bigquery.table import TimePartitioning
117
+ from google.cloud.bigquery.encryption_configuration import EncryptionConfiguration
118
+ from google.cloud.bigquery import _versions_helpers
119
+
120
+ try:
121
+ import bigquery_magics # type: ignore
122
+ except ImportError:
123
+ bigquery_magics = None
124
+
125
+ sys_major, sys_minor, sys_micro = _versions_helpers.extract_runtime_version()
126
+
127
+ if sys_major == 3 and sys_minor in (7, 8):
128
+ warnings.warn(
129
+ "The python-bigquery library no longer supports Python 3.7 "
130
+ "and Python 3.8. "
131
+ f"Your Python version is {sys_major}.{sys_minor}.{sys_micro}. We "
132
+ "recommend that you update soon to ensure ongoing support. For "
133
+ "more details, see: [Google Cloud Client Libraries Supported Python Versions policy](https://cloud.google.com/python/docs/supported-python-versions)",
134
+ FutureWarning,
135
+ )
136
+
137
+ __all__ = [
138
+ "__version__",
139
+ "Client",
140
+ # Queries
141
+ "ConnectionProperty",
142
+ "QueryJob",
143
+ "QueryJobConfig",
144
+ "ArrayQueryParameter",
145
+ "ScalarQueryParameter",
146
+ "StructQueryParameter",
147
+ "RangeQueryParameter",
148
+ "ArrayQueryParameterType",
149
+ "ScalarQueryParameterType",
150
+ "SqlParameterScalarTypes",
151
+ "StructQueryParameterType",
152
+ "RangeQueryParameterType",
153
+ # Datasets
154
+ "Dataset",
155
+ "DatasetReference",
156
+ "AccessEntry",
157
+ # Tables
158
+ "Table",
159
+ "TableReference",
160
+ "PartitionRange",
161
+ "RangePartitioning",
162
+ "Row",
163
+ "SnapshotDefinition",
164
+ "CloneDefinition",
165
+ "TimePartitioning",
166
+ "TimePartitioningType",
167
+ # Jobs
168
+ "CopyJob",
169
+ "CopyJobConfig",
170
+ "ExtractJob",
171
+ "ExtractJobConfig",
172
+ "LoadJob",
173
+ "LoadJobConfig",
174
+ "SessionInfo",
175
+ "UnknownJob",
176
+ # Models
177
+ "Model",
178
+ "ModelReference",
179
+ # Routines
180
+ "Routine",
181
+ "RoutineArgument",
182
+ "RoutineReference",
183
+ "RemoteFunctionOptions",
184
+ # Shared helpers
185
+ "SchemaField",
186
+ "FieldElementType",
187
+ "PolicyTagList",
188
+ "UDFResource",
189
+ "ExternalConfig",
190
+ "AvroOptions",
191
+ "BigtableOptions",
192
+ "BigtableColumnFamily",
193
+ "BigtableColumn",
194
+ "DmlStats",
195
+ "CSVOptions",
196
+ "GoogleSheetsOptions",
197
+ "HivePartitioningOptions",
198
+ "ParquetOptions",
199
+ "ScriptOptions",
200
+ "TransactionInfo",
201
+ "DEFAULT_RETRY",
202
+ # Standard SQL types
203
+ "StandardSqlDataType",
204
+ "StandardSqlField",
205
+ "StandardSqlStructType",
206
+ "StandardSqlTableType",
207
+ # Enum Constants
208
+ "enums",
209
+ "AutoRowIDs",
210
+ "Compression",
211
+ "CreateDisposition",
212
+ "DecimalTargetType",
213
+ "DestinationFormat",
214
+ "DeterminismLevel",
215
+ "ExternalSourceFormat",
216
+ "Encoding",
217
+ "KeyResultStatementKind",
218
+ "OperationType",
219
+ "QueryPriority",
220
+ "RoutineType",
221
+ "SchemaUpdateOption",
222
+ "SourceFormat",
223
+ "SqlTypeNames",
224
+ "StandardSqlTypeNames",
225
+ "WriteDisposition",
226
+ # EncryptionConfiguration
227
+ "EncryptionConfiguration",
228
+ # Custom exceptions
229
+ "LegacyBigQueryStorageError",
230
+ "LegacyPyarrowError",
231
+ "LegacyPandasError",
232
+ ]
233
+
234
+
235
+ def load_ipython_extension(ipython):
236
+ """Called by IPython when this module is loaded as an IPython extension."""
237
+ warnings.warn(
238
+ "%load_ext google.cloud.bigquery is deprecated. Install bigquery-magics package and use `%load_ext bigquery_magics`, instead.",
239
+ category=FutureWarning,
240
+ )
241
+
242
+ if bigquery_magics is not None:
243
+ bigquery_magics.load_ipython_extension(ipython)
244
+ else:
245
+ from google.cloud.bigquery.magics.magics import _cell_magic
246
+
247
+ ipython.register_magic_function(
248
+ _cell_magic, magic_kind="cell", magic_name="bigquery"
249
+ )