google-cloud-bigquery 3.18.0__tar.gz → 3.19.0__tar.gz
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.
- {google-cloud-bigquery-3.18.0/google_cloud_bigquery.egg-info → google-cloud-bigquery-3.19.0}/PKG-INFO +3 -2
- {google-cloud-bigquery-3.18.0 → google-cloud-bigquery-3.19.0}/google/cloud/bigquery/__init__.py +4 -0
- {google-cloud-bigquery-3.18.0 → google-cloud-bigquery-3.19.0}/google/cloud/bigquery/_helpers.py +59 -0
- {google-cloud-bigquery-3.18.0 → google-cloud-bigquery-3.19.0}/google/cloud/bigquery/client.py +19 -15
- {google-cloud-bigquery-3.18.0 → google-cloud-bigquery-3.19.0}/google/cloud/bigquery/enums.py +2 -0
- {google-cloud-bigquery-3.18.0 → google-cloud-bigquery-3.19.0}/google/cloud/bigquery/query.py +297 -0
- {google-cloud-bigquery-3.18.0 → google-cloud-bigquery-3.19.0}/google/cloud/bigquery/standard_sql.py +35 -1
- {google-cloud-bigquery-3.18.0 → google-cloud-bigquery-3.19.0}/google/cloud/bigquery/version.py +1 -1
- {google-cloud-bigquery-3.18.0 → google-cloud-bigquery-3.19.0/google_cloud_bigquery.egg-info}/PKG-INFO +3 -2
- {google-cloud-bigquery-3.18.0 → google-cloud-bigquery-3.19.0}/google_cloud_bigquery.egg-info/requires.txt +2 -1
- {google-cloud-bigquery-3.18.0 → google-cloud-bigquery-3.19.0}/setup.py +2 -1
- {google-cloud-bigquery-3.18.0 → google-cloud-bigquery-3.19.0}/tests/system/test_client.py +38 -0
- {google-cloud-bigquery-3.18.0 → google-cloud-bigquery-3.19.0}/tests/system/test_query.py +33 -0
- {google-cloud-bigquery-3.18.0 → google-cloud-bigquery-3.19.0}/tests/unit/conftest.py +2 -1
- {google-cloud-bigquery-3.18.0 → google-cloud-bigquery-3.19.0}/tests/unit/helpers.py +18 -3
- {google-cloud-bigquery-3.18.0 → google-cloud-bigquery-3.19.0}/tests/unit/job/test_base.py +1 -1
- {google-cloud-bigquery-3.18.0 → google-cloud-bigquery-3.19.0}/tests/unit/job/test_copy.py +1 -1
- {google-cloud-bigquery-3.18.0 → google-cloud-bigquery-3.19.0}/tests/unit/job/test_extract.py +1 -1
- {google-cloud-bigquery-3.18.0 → google-cloud-bigquery-3.19.0}/tests/unit/job/test_load.py +1 -2
- {google-cloud-bigquery-3.18.0 → google-cloud-bigquery-3.19.0}/tests/unit/job/test_query.py +8 -8
- {google-cloud-bigquery-3.18.0 → google-cloud-bigquery-3.19.0}/tests/unit/job/test_query_pandas.py +1 -1
- {google-cloud-bigquery-3.18.0 → google-cloud-bigquery-3.19.0}/tests/unit/test__helpers.py +95 -1
- {google-cloud-bigquery-3.18.0 → google-cloud-bigquery-3.19.0}/tests/unit/test__http.py +1 -1
- {google-cloud-bigquery-3.18.0 → google-cloud-bigquery-3.19.0}/tests/unit/test__pandas_helpers.py +3 -4
- {google-cloud-bigquery-3.18.0 → google-cloud-bigquery-3.19.0}/tests/unit/test__versions_helpers.py +2 -2
- {google-cloud-bigquery-3.18.0 → google-cloud-bigquery-3.19.0}/tests/unit/test_client.py +18 -7
- {google-cloud-bigquery-3.18.0 → google-cloud-bigquery-3.19.0}/tests/unit/test_create_dataset.py +2 -1
- {google-cloud-bigquery-3.18.0 → google-cloud-bigquery-3.19.0}/tests/unit/test_dataset.py +1 -1
- {google-cloud-bigquery-3.18.0 → google-cloud-bigquery-3.19.0}/tests/unit/test_dbapi_connection.py +1 -2
- {google-cloud-bigquery-3.18.0 → google-cloud-bigquery-3.19.0}/tests/unit/test_dbapi_cursor.py +1 -1
- {google-cloud-bigquery-3.18.0 → google-cloud-bigquery-3.19.0}/tests/unit/test_encryption_configuration.py +1 -1
- {google-cloud-bigquery-3.18.0 → google-cloud-bigquery-3.19.0}/tests/unit/test_job_retry.py +1 -1
- {google-cloud-bigquery-3.18.0 → google-cloud-bigquery-3.19.0}/tests/unit/test_list_datasets.py +2 -1
- {google-cloud-bigquery-3.18.0 → google-cloud-bigquery-3.19.0}/tests/unit/test_list_jobs.py +1 -1
- {google-cloud-bigquery-3.18.0 → google-cloud-bigquery-3.19.0}/tests/unit/test_list_projects.py +2 -1
- {google-cloud-bigquery-3.18.0 → google-cloud-bigquery-3.19.0}/tests/unit/test_magics.py +3 -3
- {google-cloud-bigquery-3.18.0 → google-cloud-bigquery-3.19.0}/tests/unit/test_opentelemetry_tracing.py +1 -2
- {google-cloud-bigquery-3.18.0 → google-cloud-bigquery-3.19.0}/tests/unit/test_query.py +549 -2
- {google-cloud-bigquery-3.18.0 → google-cloud-bigquery-3.19.0}/tests/unit/test_retry.py +1 -1
- {google-cloud-bigquery-3.18.0 → google-cloud-bigquery-3.19.0}/tests/unit/test_schema.py +1 -1
- {google-cloud-bigquery-3.18.0 → google-cloud-bigquery-3.19.0}/tests/unit/test_standard_sql_types.py +52 -0
- {google-cloud-bigquery-3.18.0 → google-cloud-bigquery-3.19.0}/tests/unit/test_table.py +1 -1
- {google-cloud-bigquery-3.18.0 → google-cloud-bigquery-3.19.0}/LICENSE +0 -0
- {google-cloud-bigquery-3.18.0 → google-cloud-bigquery-3.19.0}/MANIFEST.in +0 -0
- {google-cloud-bigquery-3.18.0 → google-cloud-bigquery-3.19.0}/README.rst +0 -0
- {google-cloud-bigquery-3.18.0 → google-cloud-bigquery-3.19.0}/google/cloud/bigquery/_http.py +0 -0
- {google-cloud-bigquery-3.18.0 → google-cloud-bigquery-3.19.0}/google/cloud/bigquery/_job_helpers.py +0 -0
- {google-cloud-bigquery-3.18.0 → google-cloud-bigquery-3.19.0}/google/cloud/bigquery/_pandas_helpers.py +0 -0
- {google-cloud-bigquery-3.18.0 → google-cloud-bigquery-3.19.0}/google/cloud/bigquery/_pyarrow_helpers.py +0 -0
- {google-cloud-bigquery-3.18.0 → google-cloud-bigquery-3.19.0}/google/cloud/bigquery/_tqdm_helpers.py +0 -0
- {google-cloud-bigquery-3.18.0 → google-cloud-bigquery-3.19.0}/google/cloud/bigquery/_versions_helpers.py +0 -0
- {google-cloud-bigquery-3.18.0 → google-cloud-bigquery-3.19.0}/google/cloud/bigquery/dataset.py +0 -0
- {google-cloud-bigquery-3.18.0 → google-cloud-bigquery-3.19.0}/google/cloud/bigquery/dbapi/__init__.py +0 -0
- {google-cloud-bigquery-3.18.0 → google-cloud-bigquery-3.19.0}/google/cloud/bigquery/dbapi/_helpers.py +0 -0
- {google-cloud-bigquery-3.18.0 → google-cloud-bigquery-3.19.0}/google/cloud/bigquery/dbapi/connection.py +0 -0
- {google-cloud-bigquery-3.18.0 → google-cloud-bigquery-3.19.0}/google/cloud/bigquery/dbapi/cursor.py +0 -0
- {google-cloud-bigquery-3.18.0 → google-cloud-bigquery-3.19.0}/google/cloud/bigquery/dbapi/exceptions.py +0 -0
- {google-cloud-bigquery-3.18.0 → google-cloud-bigquery-3.19.0}/google/cloud/bigquery/dbapi/types.py +0 -0
- {google-cloud-bigquery-3.18.0 → google-cloud-bigquery-3.19.0}/google/cloud/bigquery/encryption_configuration.py +0 -0
- {google-cloud-bigquery-3.18.0 → google-cloud-bigquery-3.19.0}/google/cloud/bigquery/exceptions.py +0 -0
- {google-cloud-bigquery-3.18.0 → google-cloud-bigquery-3.19.0}/google/cloud/bigquery/external_config.py +0 -0
- {google-cloud-bigquery-3.18.0 → google-cloud-bigquery-3.19.0}/google/cloud/bigquery/format_options.py +0 -0
- {google-cloud-bigquery-3.18.0 → google-cloud-bigquery-3.19.0}/google/cloud/bigquery/iam.py +0 -0
- {google-cloud-bigquery-3.18.0 → google-cloud-bigquery-3.19.0}/google/cloud/bigquery/job/__init__.py +0 -0
- {google-cloud-bigquery-3.18.0 → google-cloud-bigquery-3.19.0}/google/cloud/bigquery/job/base.py +0 -0
- {google-cloud-bigquery-3.18.0 → google-cloud-bigquery-3.19.0}/google/cloud/bigquery/job/copy_.py +0 -0
- {google-cloud-bigquery-3.18.0 → google-cloud-bigquery-3.19.0}/google/cloud/bigquery/job/extract.py +0 -0
- {google-cloud-bigquery-3.18.0 → google-cloud-bigquery-3.19.0}/google/cloud/bigquery/job/load.py +0 -0
- {google-cloud-bigquery-3.18.0 → google-cloud-bigquery-3.19.0}/google/cloud/bigquery/job/query.py +0 -0
- {google-cloud-bigquery-3.18.0 → google-cloud-bigquery-3.19.0}/google/cloud/bigquery/magics/__init__.py +0 -0
- {google-cloud-bigquery-3.18.0 → google-cloud-bigquery-3.19.0}/google/cloud/bigquery/magics/line_arg_parser/__init__.py +0 -0
- {google-cloud-bigquery-3.18.0 → google-cloud-bigquery-3.19.0}/google/cloud/bigquery/magics/line_arg_parser/exceptions.py +0 -0
- {google-cloud-bigquery-3.18.0 → google-cloud-bigquery-3.19.0}/google/cloud/bigquery/magics/line_arg_parser/lexer.py +0 -0
- {google-cloud-bigquery-3.18.0 → google-cloud-bigquery-3.19.0}/google/cloud/bigquery/magics/line_arg_parser/parser.py +0 -0
- {google-cloud-bigquery-3.18.0 → google-cloud-bigquery-3.19.0}/google/cloud/bigquery/magics/line_arg_parser/visitors.py +0 -0
- {google-cloud-bigquery-3.18.0 → google-cloud-bigquery-3.19.0}/google/cloud/bigquery/magics/magics.py +0 -0
- {google-cloud-bigquery-3.18.0 → google-cloud-bigquery-3.19.0}/google/cloud/bigquery/model.py +0 -0
- {google-cloud-bigquery-3.18.0 → google-cloud-bigquery-3.19.0}/google/cloud/bigquery/opentelemetry_tracing.py +0 -0
- {google-cloud-bigquery-3.18.0 → google-cloud-bigquery-3.19.0}/google/cloud/bigquery/py.typed +0 -0
- {google-cloud-bigquery-3.18.0 → google-cloud-bigquery-3.19.0}/google/cloud/bigquery/retry.py +0 -0
- {google-cloud-bigquery-3.18.0 → google-cloud-bigquery-3.19.0}/google/cloud/bigquery/routine/__init__.py +0 -0
- {google-cloud-bigquery-3.18.0 → google-cloud-bigquery-3.19.0}/google/cloud/bigquery/routine/routine.py +0 -0
- {google-cloud-bigquery-3.18.0 → google-cloud-bigquery-3.19.0}/google/cloud/bigquery/schema.py +0 -0
- {google-cloud-bigquery-3.18.0 → google-cloud-bigquery-3.19.0}/google/cloud/bigquery/table.py +0 -0
- {google-cloud-bigquery-3.18.0 → google-cloud-bigquery-3.19.0}/google/cloud/bigquery_v2/__init__.py +0 -0
- {google-cloud-bigquery-3.18.0 → google-cloud-bigquery-3.19.0}/google/cloud/bigquery_v2/types/__init__.py +0 -0
- {google-cloud-bigquery-3.18.0 → google-cloud-bigquery-3.19.0}/google/cloud/bigquery_v2/types/encryption_config.py +0 -0
- {google-cloud-bigquery-3.18.0 → google-cloud-bigquery-3.19.0}/google/cloud/bigquery_v2/types/model.py +0 -0
- {google-cloud-bigquery-3.18.0 → google-cloud-bigquery-3.19.0}/google/cloud/bigquery_v2/types/model_reference.py +0 -0
- {google-cloud-bigquery-3.18.0 → google-cloud-bigquery-3.19.0}/google/cloud/bigquery_v2/types/standard_sql.py +0 -0
- {google-cloud-bigquery-3.18.0 → google-cloud-bigquery-3.19.0}/google/cloud/bigquery_v2/types/table_reference.py +0 -0
- {google-cloud-bigquery-3.18.0 → google-cloud-bigquery-3.19.0}/google_cloud_bigquery.egg-info/SOURCES.txt +0 -0
- {google-cloud-bigquery-3.18.0 → google-cloud-bigquery-3.19.0}/google_cloud_bigquery.egg-info/dependency_links.txt +0 -0
- {google-cloud-bigquery-3.18.0 → google-cloud-bigquery-3.19.0}/google_cloud_bigquery.egg-info/not-zip-safe +0 -0
- {google-cloud-bigquery-3.18.0 → google-cloud-bigquery-3.19.0}/google_cloud_bigquery.egg-info/top_level.txt +0 -0
- {google-cloud-bigquery-3.18.0 → google-cloud-bigquery-3.19.0}/setup.cfg +0 -0
- {google-cloud-bigquery-3.18.0 → google-cloud-bigquery-3.19.0}/tests/__init__.py +0 -0
- {google-cloud-bigquery-3.18.0 → google-cloud-bigquery-3.19.0}/tests/data/characters.json +0 -0
- {google-cloud-bigquery-3.18.0 → google-cloud-bigquery-3.19.0}/tests/data/characters.jsonl +0 -0
- {google-cloud-bigquery-3.18.0 → google-cloud-bigquery-3.19.0}/tests/data/colors.avro +0 -0
- {google-cloud-bigquery-3.18.0 → google-cloud-bigquery-3.19.0}/tests/data/numeric_38_12.parquet +0 -0
- {google-cloud-bigquery-3.18.0 → google-cloud-bigquery-3.19.0}/tests/data/people.csv +0 -0
- {google-cloud-bigquery-3.18.0 → google-cloud-bigquery-3.19.0}/tests/data/scalars.jsonl +0 -0
- {google-cloud-bigquery-3.18.0 → google-cloud-bigquery-3.19.0}/tests/data/scalars_extreme.jsonl +0 -0
- {google-cloud-bigquery-3.18.0 → google-cloud-bigquery-3.19.0}/tests/data/scalars_schema.json +0 -0
- {google-cloud-bigquery-3.18.0 → google-cloud-bigquery-3.19.0}/tests/data/schema.json +0 -0
- {google-cloud-bigquery-3.18.0 → google-cloud-bigquery-3.19.0}/tests/scrub_datasets.py +0 -0
- {google-cloud-bigquery-3.18.0 → google-cloud-bigquery-3.19.0}/tests/system/__init__.py +0 -0
- {google-cloud-bigquery-3.18.0 → google-cloud-bigquery-3.19.0}/tests/system/conftest.py +0 -0
- {google-cloud-bigquery-3.18.0 → google-cloud-bigquery-3.19.0}/tests/system/helpers.py +0 -0
- {google-cloud-bigquery-3.18.0 → google-cloud-bigquery-3.19.0}/tests/system/test_arrow.py +0 -0
- {google-cloud-bigquery-3.18.0 → google-cloud-bigquery-3.19.0}/tests/system/test_job_retry.py +0 -0
- {google-cloud-bigquery-3.18.0 → google-cloud-bigquery-3.19.0}/tests/system/test_list_rows.py +0 -0
- {google-cloud-bigquery-3.18.0 → google-cloud-bigquery-3.19.0}/tests/system/test_magics.py +0 -0
- {google-cloud-bigquery-3.18.0 → google-cloud-bigquery-3.19.0}/tests/system/test_pandas.py +0 -0
- {google-cloud-bigquery-3.18.0 → google-cloud-bigquery-3.19.0}/tests/system/test_structs.py +0 -0
- {google-cloud-bigquery-3.18.0 → google-cloud-bigquery-3.19.0}/tests/unit/__init__.py +0 -0
- {google-cloud-bigquery-3.18.0 → google-cloud-bigquery-3.19.0}/tests/unit/_helpers/__init__.py +0 -0
- {google-cloud-bigquery-3.18.0 → google-cloud-bigquery-3.19.0}/tests/unit/_helpers/test_from_json.py +0 -0
- {google-cloud-bigquery-3.18.0 → google-cloud-bigquery-3.19.0}/tests/unit/job/__init__.py +0 -0
- {google-cloud-bigquery-3.18.0 → google-cloud-bigquery-3.19.0}/tests/unit/job/helpers.py +0 -0
- {google-cloud-bigquery-3.18.0 → google-cloud-bigquery-3.19.0}/tests/unit/job/test_load_config.py +0 -0
- {google-cloud-bigquery-3.18.0 → google-cloud-bigquery-3.19.0}/tests/unit/job/test_query_config.py +0 -0
- {google-cloud-bigquery-3.18.0 → google-cloud-bigquery-3.19.0}/tests/unit/job/test_query_stats.py +0 -0
- {google-cloud-bigquery-3.18.0 → google-cloud-bigquery-3.19.0}/tests/unit/line_arg_parser/__init__.py +0 -0
- {google-cloud-bigquery-3.18.0 → google-cloud-bigquery-3.19.0}/tests/unit/line_arg_parser/test_lexer.py +0 -0
- {google-cloud-bigquery-3.18.0 → google-cloud-bigquery-3.19.0}/tests/unit/line_arg_parser/test_parser.py +0 -0
- {google-cloud-bigquery-3.18.0 → google-cloud-bigquery-3.19.0}/tests/unit/line_arg_parser/test_visitors.py +0 -0
- {google-cloud-bigquery-3.18.0 → google-cloud-bigquery-3.19.0}/tests/unit/model/__init__.py +0 -0
- {google-cloud-bigquery-3.18.0 → google-cloud-bigquery-3.19.0}/tests/unit/model/test_model.py +0 -0
- {google-cloud-bigquery-3.18.0 → google-cloud-bigquery-3.19.0}/tests/unit/model/test_model_reference.py +0 -0
- {google-cloud-bigquery-3.18.0 → google-cloud-bigquery-3.19.0}/tests/unit/routine/__init__.py +0 -0
- {google-cloud-bigquery-3.18.0 → google-cloud-bigquery-3.19.0}/tests/unit/routine/test_remote_function_options.py +0 -0
- {google-cloud-bigquery-3.18.0 → google-cloud-bigquery-3.19.0}/tests/unit/routine/test_routine.py +0 -0
- {google-cloud-bigquery-3.18.0 → google-cloud-bigquery-3.19.0}/tests/unit/routine/test_routine_argument.py +0 -0
- {google-cloud-bigquery-3.18.0 → google-cloud-bigquery-3.19.0}/tests/unit/routine/test_routine_reference.py +0 -0
- {google-cloud-bigquery-3.18.0 → google-cloud-bigquery-3.19.0}/tests/unit/test__job_helpers.py +0 -0
- {google-cloud-bigquery-3.18.0 → google-cloud-bigquery-3.19.0}/tests/unit/test__pyarrow_helpers.py +0 -0
- {google-cloud-bigquery-3.18.0 → google-cloud-bigquery-3.19.0}/tests/unit/test_dbapi__helpers.py +0 -0
- {google-cloud-bigquery-3.18.0 → google-cloud-bigquery-3.19.0}/tests/unit/test_dbapi_types.py +0 -0
- {google-cloud-bigquery-3.18.0 → google-cloud-bigquery-3.19.0}/tests/unit/test_delete_dataset.py +0 -0
- {google-cloud-bigquery-3.18.0 → google-cloud-bigquery-3.19.0}/tests/unit/test_external_config.py +0 -0
- {google-cloud-bigquery-3.18.0 → google-cloud-bigquery-3.19.0}/tests/unit/test_format_options.py +0 -0
- {google-cloud-bigquery-3.18.0 → google-cloud-bigquery-3.19.0}/tests/unit/test_legacy_types.py +0 -0
- {google-cloud-bigquery-3.18.0 → google-cloud-bigquery-3.19.0}/tests/unit/test_list_models.py +0 -0
- {google-cloud-bigquery-3.18.0 → google-cloud-bigquery-3.19.0}/tests/unit/test_list_routines.py +0 -0
- {google-cloud-bigquery-3.18.0 → google-cloud-bigquery-3.19.0}/tests/unit/test_list_tables.py +0 -0
- {google-cloud-bigquery-3.18.0 → google-cloud-bigquery-3.19.0}/tests/unit/test_packaging.py +0 -0
- {google-cloud-bigquery-3.18.0 → google-cloud-bigquery-3.19.0}/tests/unit/test_signature_compatibility.py +0 -0
- {google-cloud-bigquery-3.18.0 → google-cloud-bigquery-3.19.0}/tests/unit/test_table_arrow.py +0 -0
- {google-cloud-bigquery-3.18.0 → google-cloud-bigquery-3.19.0}/tests/unit/test_table_pandas.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: google-cloud-bigquery
|
|
3
|
-
Version: 3.
|
|
3
|
+
Version: 3.19.0
|
|
4
4
|
Summary: Google BigQuery API client library
|
|
5
5
|
Home-page: https://github.com/googleapis/python-bigquery
|
|
6
6
|
Author: Google LLC
|
|
@@ -22,7 +22,8 @@ Classifier: Operating System :: OS Independent
|
|
|
22
22
|
Classifier: Topic :: Internet
|
|
23
23
|
Requires-Python: >=3.7
|
|
24
24
|
License-File: LICENSE
|
|
25
|
-
Requires-Dist: google-api-core!=2.0.*,!=2.1.*,!=2.2.*,!=2.3.
|
|
25
|
+
Requires-Dist: google-api-core[grpc]!=2.0.*,!=2.1.*,!=2.10.*,!=2.2.*,!=2.3.*,!=2.4.*,!=2.5.*,!=2.6.*,!=2.7.*,!=2.8.*,!=2.9.*,<3.0.0dev,>=1.34.1
|
|
26
|
+
Requires-Dist: google-auth<3.0.0dev,>=2.14.1
|
|
26
27
|
Requires-Dist: google-cloud-core<3.0.0dev,>=1.6.0
|
|
27
28
|
Requires-Dist: google-resumable-media<3.0dev,>=0.6.0
|
|
28
29
|
Requires-Dist: packaging>=20.0.0
|
{google-cloud-bigquery-3.18.0 → google-cloud-bigquery-3.19.0}/google/cloud/bigquery/__init__.py
RENAMED
|
@@ -83,6 +83,8 @@ from google.cloud.bigquery.query import ArrayQueryParameterType
|
|
|
83
83
|
from google.cloud.bigquery.query import ConnectionProperty
|
|
84
84
|
from google.cloud.bigquery.query import ScalarQueryParameter
|
|
85
85
|
from google.cloud.bigquery.query import ScalarQueryParameterType
|
|
86
|
+
from google.cloud.bigquery.query import RangeQueryParameter
|
|
87
|
+
from google.cloud.bigquery.query import RangeQueryParameterType
|
|
86
88
|
from google.cloud.bigquery.query import SqlParameterScalarTypes
|
|
87
89
|
from google.cloud.bigquery.query import StructQueryParameter
|
|
88
90
|
from google.cloud.bigquery.query import StructQueryParameterType
|
|
@@ -122,10 +124,12 @@ __all__ = [
|
|
|
122
124
|
"ArrayQueryParameter",
|
|
123
125
|
"ScalarQueryParameter",
|
|
124
126
|
"StructQueryParameter",
|
|
127
|
+
"RangeQueryParameter",
|
|
125
128
|
"ArrayQueryParameterType",
|
|
126
129
|
"ScalarQueryParameterType",
|
|
127
130
|
"SqlParameterScalarTypes",
|
|
128
131
|
"StructQueryParameterType",
|
|
132
|
+
"RangeQueryParameterType",
|
|
129
133
|
# Datasets
|
|
130
134
|
"Dataset",
|
|
131
135
|
"DatasetReference",
|
{google-cloud-bigquery-3.18.0 → google-cloud-bigquery-3.19.0}/google/cloud/bigquery/_helpers.py
RENAMED
|
@@ -30,6 +30,8 @@ from google.cloud._helpers import _datetime_from_microseconds
|
|
|
30
30
|
from google.cloud._helpers import _RFC3339_MICROS
|
|
31
31
|
from google.cloud._helpers import _RFC3339_NO_FRACTION
|
|
32
32
|
from google.cloud._helpers import _to_bytes
|
|
33
|
+
from google.auth import credentials as ga_credentials # type: ignore
|
|
34
|
+
from google.api_core import client_options as client_options_lib
|
|
33
35
|
|
|
34
36
|
_RFC3339_MICROS_NO_ZULU = "%Y-%m-%dT%H:%M:%S.%f"
|
|
35
37
|
_TIMEONLY_WO_MICROS = "%H:%M:%S"
|
|
@@ -55,9 +57,66 @@ BIGQUERY_EMULATOR_HOST = "BIGQUERY_EMULATOR_HOST"
|
|
|
55
57
|
_DEFAULT_HOST = "https://bigquery.googleapis.com"
|
|
56
58
|
"""Default host for JSON API."""
|
|
57
59
|
|
|
60
|
+
_DEFAULT_HOST_TEMPLATE = "https://bigquery.{UNIVERSE_DOMAIN}"
|
|
61
|
+
""" Templatized endpoint format. """
|
|
62
|
+
|
|
58
63
|
_DEFAULT_UNIVERSE = "googleapis.com"
|
|
59
64
|
"""Default universe for the JSON API."""
|
|
60
65
|
|
|
66
|
+
_UNIVERSE_DOMAIN_ENV = "GOOGLE_CLOUD_UNIVERSE_DOMAIN"
|
|
67
|
+
"""Environment variable for setting universe domain."""
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
def _get_client_universe(
|
|
71
|
+
client_options: Optional[Union[client_options_lib.ClientOptions, dict]]
|
|
72
|
+
) -> str:
|
|
73
|
+
"""Retrieves the specified universe setting.
|
|
74
|
+
|
|
75
|
+
Args:
|
|
76
|
+
client_options: specified client options.
|
|
77
|
+
Returns:
|
|
78
|
+
str: resolved universe setting.
|
|
79
|
+
|
|
80
|
+
"""
|
|
81
|
+
if isinstance(client_options, dict):
|
|
82
|
+
client_options = client_options_lib.from_dict(client_options)
|
|
83
|
+
universe = _DEFAULT_UNIVERSE
|
|
84
|
+
options_universe = getattr(client_options, "universe_domain", None)
|
|
85
|
+
if (
|
|
86
|
+
options_universe
|
|
87
|
+
and isinstance(options_universe, str)
|
|
88
|
+
and len(options_universe) > 0
|
|
89
|
+
):
|
|
90
|
+
universe = options_universe
|
|
91
|
+
else:
|
|
92
|
+
env_universe = os.getenv(_UNIVERSE_DOMAIN_ENV)
|
|
93
|
+
if isinstance(env_universe, str) and len(env_universe) > 0:
|
|
94
|
+
universe = env_universe
|
|
95
|
+
return universe
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
def _validate_universe(client_universe: str, credentials: ga_credentials.Credentials):
|
|
99
|
+
"""Validates that client provided universe and universe embedded in credentials match.
|
|
100
|
+
|
|
101
|
+
Args:
|
|
102
|
+
client_universe (str): The universe domain configured via the client options.
|
|
103
|
+
credentials (ga_credentials.Credentials): The credentials being used in the client.
|
|
104
|
+
|
|
105
|
+
Raises:
|
|
106
|
+
ValueError: when client_universe does not match the universe in credentials.
|
|
107
|
+
"""
|
|
108
|
+
if hasattr(credentials, "universe_domain"):
|
|
109
|
+
cred_universe = getattr(credentials, "universe_domain")
|
|
110
|
+
if isinstance(cred_universe, str):
|
|
111
|
+
if client_universe != cred_universe:
|
|
112
|
+
raise ValueError(
|
|
113
|
+
"The configured universe domain "
|
|
114
|
+
f"({client_universe}) does not match the universe domain "
|
|
115
|
+
f"found in the credentials ({cred_universe}). "
|
|
116
|
+
"If you haven't configured the universe domain explicitly, "
|
|
117
|
+
f"`{_DEFAULT_UNIVERSE}` is the default."
|
|
118
|
+
)
|
|
119
|
+
|
|
61
120
|
|
|
62
121
|
def _get_bigquery_host():
|
|
63
122
|
return os.environ.get(BIGQUERY_EMULATOR_HOST, _DEFAULT_HOST)
|
{google-cloud-bigquery-3.18.0 → google-cloud-bigquery-3.19.0}/google/cloud/bigquery/client.py
RENAMED
|
@@ -78,7 +78,10 @@ from google.cloud.bigquery._helpers import _str_or_none
|
|
|
78
78
|
from google.cloud.bigquery._helpers import _verify_job_config_type
|
|
79
79
|
from google.cloud.bigquery._helpers import _get_bigquery_host
|
|
80
80
|
from google.cloud.bigquery._helpers import _DEFAULT_HOST
|
|
81
|
+
from google.cloud.bigquery._helpers import _DEFAULT_HOST_TEMPLATE
|
|
81
82
|
from google.cloud.bigquery._helpers import _DEFAULT_UNIVERSE
|
|
83
|
+
from google.cloud.bigquery._helpers import _validate_universe
|
|
84
|
+
from google.cloud.bigquery._helpers import _get_client_universe
|
|
82
85
|
from google.cloud.bigquery._job_helpers import make_job_id as _make_job_id
|
|
83
86
|
from google.cloud.bigquery.dataset import Dataset
|
|
84
87
|
from google.cloud.bigquery.dataset import DatasetListItem
|
|
@@ -245,22 +248,23 @@ class Client(ClientWithProject):
|
|
|
245
248
|
kw_args = {"client_info": client_info}
|
|
246
249
|
bq_host = _get_bigquery_host()
|
|
247
250
|
kw_args["api_endpoint"] = bq_host if bq_host != _DEFAULT_HOST else None
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
kw_args["api_endpoint"] = _DEFAULT_HOST.replace(
|
|
262
|
-
_DEFAULT_UNIVERSE, client_options.universe_domain
|
|
251
|
+
client_universe = None
|
|
252
|
+
if client_options is None:
|
|
253
|
+
client_options = {}
|
|
254
|
+
if isinstance(client_options, dict):
|
|
255
|
+
client_options = google.api_core.client_options.from_dict(client_options)
|
|
256
|
+
if client_options.api_endpoint:
|
|
257
|
+
api_endpoint = client_options.api_endpoint
|
|
258
|
+
kw_args["api_endpoint"] = api_endpoint
|
|
259
|
+
else:
|
|
260
|
+
client_universe = _get_client_universe(client_options)
|
|
261
|
+
if client_universe != _DEFAULT_UNIVERSE:
|
|
262
|
+
kw_args["api_endpoint"] = _DEFAULT_HOST_TEMPLATE.replace(
|
|
263
|
+
"{UNIVERSE_DOMAIN}", client_universe
|
|
263
264
|
)
|
|
265
|
+
# Ensure credentials and universe are not in conflict.
|
|
266
|
+
if hasattr(self, "_credentials") and client_universe is not None:
|
|
267
|
+
_validate_universe(client_universe, self._credentials)
|
|
264
268
|
|
|
265
269
|
self._connection = Connection(self, **kw_args)
|
|
266
270
|
self._location = location
|
{google-cloud-bigquery-3.18.0 → google-cloud-bigquery-3.19.0}/google/cloud/bigquery/enums.py
RENAMED
|
@@ -254,6 +254,7 @@ class StandardSqlTypeNames(str, enum.Enum):
|
|
|
254
254
|
JSON = enum.auto()
|
|
255
255
|
ARRAY = enum.auto()
|
|
256
256
|
STRUCT = enum.auto()
|
|
257
|
+
RANGE = enum.auto()
|
|
257
258
|
|
|
258
259
|
|
|
259
260
|
class EntityTypes(str, enum.Enum):
|
|
@@ -292,6 +293,7 @@ class SqlTypeNames(str, enum.Enum):
|
|
|
292
293
|
TIME = "TIME"
|
|
293
294
|
DATETIME = "DATETIME"
|
|
294
295
|
INTERVAL = "INTERVAL" # NOTE: not available in legacy types
|
|
296
|
+
RANGE = "RANGE" # NOTE: not available in legacy types
|
|
295
297
|
|
|
296
298
|
|
|
297
299
|
class WriteDisposition(object):
|
{google-cloud-bigquery-3.18.0 → google-cloud-bigquery-3.19.0}/google/cloud/bigquery/query.py
RENAMED
|
@@ -30,6 +30,8 @@ _SCALAR_VALUE_TYPE = Optional[
|
|
|
30
30
|
Union[str, int, float, decimal.Decimal, bool, datetime.datetime, datetime.date]
|
|
31
31
|
]
|
|
32
32
|
|
|
33
|
+
_RANGE_ELEMENT_TYPE_STR = {"TIMESTAMP", "DATETIME", "DATE"}
|
|
34
|
+
|
|
33
35
|
|
|
34
36
|
class ConnectionProperty:
|
|
35
37
|
"""A connection-level property to customize query behavior.
|
|
@@ -362,6 +364,129 @@ class StructQueryParameterType(_AbstractQueryParameterType):
|
|
|
362
364
|
return f"{self.__class__.__name__}({items}{name}{description})"
|
|
363
365
|
|
|
364
366
|
|
|
367
|
+
class RangeQueryParameterType(_AbstractQueryParameterType):
|
|
368
|
+
"""Type representation for range query parameters.
|
|
369
|
+
|
|
370
|
+
Args:
|
|
371
|
+
type_ (Union[ScalarQueryParameterType, str]):
|
|
372
|
+
Type of range element, must be one of 'TIMESTAMP', 'DATETIME', or
|
|
373
|
+
'DATE'.
|
|
374
|
+
name (Optional[str]):
|
|
375
|
+
The name of the query parameter. Primarily used if the type is
|
|
376
|
+
one of the subfields in ``StructQueryParameterType`` instance.
|
|
377
|
+
description (Optional[str]):
|
|
378
|
+
The query parameter description. Primarily used if the type is
|
|
379
|
+
one of the subfields in ``StructQueryParameterType`` instance.
|
|
380
|
+
"""
|
|
381
|
+
|
|
382
|
+
@classmethod
|
|
383
|
+
def _parse_range_element_type(self, type_):
|
|
384
|
+
"""Helper method that parses the input range element type, which may
|
|
385
|
+
be a string, or a ScalarQueryParameterType object.
|
|
386
|
+
|
|
387
|
+
Returns:
|
|
388
|
+
google.cloud.bigquery.query.ScalarQueryParameterType: Instance
|
|
389
|
+
"""
|
|
390
|
+
if isinstance(type_, str):
|
|
391
|
+
if type_ not in _RANGE_ELEMENT_TYPE_STR:
|
|
392
|
+
raise ValueError(
|
|
393
|
+
"If given as a string, range element type must be one of "
|
|
394
|
+
"'TIMESTAMP', 'DATE', or 'DATETIME'."
|
|
395
|
+
)
|
|
396
|
+
return ScalarQueryParameterType(type_)
|
|
397
|
+
elif isinstance(type_, ScalarQueryParameterType):
|
|
398
|
+
if type_._type not in _RANGE_ELEMENT_TYPE_STR:
|
|
399
|
+
raise ValueError(
|
|
400
|
+
"If given as a ScalarQueryParameter object, range element "
|
|
401
|
+
"type must be one of 'TIMESTAMP', 'DATE', or 'DATETIME' "
|
|
402
|
+
"type."
|
|
403
|
+
)
|
|
404
|
+
return type_
|
|
405
|
+
else:
|
|
406
|
+
raise ValueError(
|
|
407
|
+
"range_type must be a string or ScalarQueryParameter object, "
|
|
408
|
+
"of 'TIMESTAMP', 'DATE', or 'DATETIME' type."
|
|
409
|
+
)
|
|
410
|
+
|
|
411
|
+
def __init__(self, type_, *, name=None, description=None):
|
|
412
|
+
self.type_ = self._parse_range_element_type(type_)
|
|
413
|
+
self.name = name
|
|
414
|
+
self.description = description
|
|
415
|
+
|
|
416
|
+
@classmethod
|
|
417
|
+
def from_api_repr(cls, resource):
|
|
418
|
+
"""Factory: construct parameter type from JSON resource.
|
|
419
|
+
|
|
420
|
+
Args:
|
|
421
|
+
resource (Dict): JSON mapping of parameter
|
|
422
|
+
|
|
423
|
+
Returns:
|
|
424
|
+
google.cloud.bigquery.query.RangeQueryParameterType: Instance
|
|
425
|
+
"""
|
|
426
|
+
type_ = resource["rangeElementType"]["type"]
|
|
427
|
+
name = resource.get("name")
|
|
428
|
+
description = resource.get("description")
|
|
429
|
+
|
|
430
|
+
return cls(type_, name=name, description=description)
|
|
431
|
+
|
|
432
|
+
def to_api_repr(self):
|
|
433
|
+
"""Construct JSON API representation for the parameter type.
|
|
434
|
+
|
|
435
|
+
Returns:
|
|
436
|
+
Dict: JSON mapping
|
|
437
|
+
"""
|
|
438
|
+
# Name and description are only used if the type is a field inside a struct
|
|
439
|
+
# type, but it's StructQueryParameterType's responsibilty to use these two
|
|
440
|
+
# attributes in the API representation when needed. Here we omit them.
|
|
441
|
+
return {
|
|
442
|
+
"type": "RANGE",
|
|
443
|
+
"rangeElementType": self.type_.to_api_repr(),
|
|
444
|
+
}
|
|
445
|
+
|
|
446
|
+
def with_name(self, new_name: Union[str, None]):
|
|
447
|
+
"""Return a copy of the instance with ``name`` set to ``new_name``.
|
|
448
|
+
|
|
449
|
+
Args:
|
|
450
|
+
name (Union[str, None]):
|
|
451
|
+
The new name of the range query parameter type. If ``None``,
|
|
452
|
+
the existing name is cleared.
|
|
453
|
+
|
|
454
|
+
Returns:
|
|
455
|
+
google.cloud.bigquery.query.RangeQueryParameterType:
|
|
456
|
+
A new instance with updated name.
|
|
457
|
+
"""
|
|
458
|
+
return type(self)(self.type_, name=new_name, description=self.description)
|
|
459
|
+
|
|
460
|
+
def __repr__(self):
|
|
461
|
+
name = f", name={self.name!r}" if self.name is not None else ""
|
|
462
|
+
description = (
|
|
463
|
+
f", description={self.description!r}"
|
|
464
|
+
if self.description is not None
|
|
465
|
+
else ""
|
|
466
|
+
)
|
|
467
|
+
return f"{self.__class__.__name__}({self.type_!r}{name}{description})"
|
|
468
|
+
|
|
469
|
+
def _key(self):
|
|
470
|
+
"""A tuple key that uniquely describes this field.
|
|
471
|
+
|
|
472
|
+
Used to compute this instance's hashcode and evaluate equality.
|
|
473
|
+
|
|
474
|
+
Returns:
|
|
475
|
+
Tuple: The contents of this
|
|
476
|
+
:class:`~google.cloud.bigquery.query.RangeQueryParameterType`.
|
|
477
|
+
"""
|
|
478
|
+
type_ = self.type_.to_api_repr()
|
|
479
|
+
return (self.name, type_, self.description)
|
|
480
|
+
|
|
481
|
+
def __eq__(self, other):
|
|
482
|
+
if not isinstance(other, RangeQueryParameterType):
|
|
483
|
+
return NotImplemented
|
|
484
|
+
return self._key() == other._key()
|
|
485
|
+
|
|
486
|
+
def __ne__(self, other):
|
|
487
|
+
return not self == other
|
|
488
|
+
|
|
489
|
+
|
|
365
490
|
class _AbstractQueryParameter(object):
|
|
366
491
|
"""Base class for named / positional query parameters."""
|
|
367
492
|
|
|
@@ -811,6 +936,178 @@ class StructQueryParameter(_AbstractQueryParameter):
|
|
|
811
936
|
return "StructQueryParameter{}".format(self._key())
|
|
812
937
|
|
|
813
938
|
|
|
939
|
+
class RangeQueryParameter(_AbstractQueryParameter):
|
|
940
|
+
"""Named / positional query parameters for range values.
|
|
941
|
+
|
|
942
|
+
Args:
|
|
943
|
+
range_element_type (Union[str, RangeQueryParameterType]):
|
|
944
|
+
The type of range elements. It must be one of 'TIMESTAMP',
|
|
945
|
+
'DATE', or 'DATETIME'.
|
|
946
|
+
|
|
947
|
+
start (Optional[Union[ScalarQueryParameter, str]]):
|
|
948
|
+
The start of the range value. Must be the same type as
|
|
949
|
+
range_element_type. If not provided, it's interpreted as UNBOUNDED.
|
|
950
|
+
|
|
951
|
+
end (Optional[Union[ScalarQueryParameter, str]]):
|
|
952
|
+
The end of the range value. Must be the same type as
|
|
953
|
+
range_element_type. If not provided, it's interpreted as UNBOUNDED.
|
|
954
|
+
|
|
955
|
+
name (Optional[str]):
|
|
956
|
+
Parameter name, used via ``@foo`` syntax. If None, the
|
|
957
|
+
parameter can only be addressed via position (``?``).
|
|
958
|
+
"""
|
|
959
|
+
|
|
960
|
+
@classmethod
|
|
961
|
+
def _parse_range_element_type(self, range_element_type):
|
|
962
|
+
if isinstance(range_element_type, str):
|
|
963
|
+
if range_element_type not in _RANGE_ELEMENT_TYPE_STR:
|
|
964
|
+
raise ValueError(
|
|
965
|
+
"If given as a string, range_element_type must be one of "
|
|
966
|
+
f"'TIMESTAMP', 'DATE', or 'DATETIME'. Got {range_element_type}."
|
|
967
|
+
)
|
|
968
|
+
return RangeQueryParameterType(range_element_type)
|
|
969
|
+
elif isinstance(range_element_type, RangeQueryParameterType):
|
|
970
|
+
if range_element_type.type_._type not in _RANGE_ELEMENT_TYPE_STR:
|
|
971
|
+
raise ValueError(
|
|
972
|
+
"If given as a RangeQueryParameterType object, "
|
|
973
|
+
"range_element_type must be one of 'TIMESTAMP', 'DATE', "
|
|
974
|
+
"or 'DATETIME' type."
|
|
975
|
+
)
|
|
976
|
+
return range_element_type
|
|
977
|
+
else:
|
|
978
|
+
raise ValueError(
|
|
979
|
+
"range_element_type must be a string or "
|
|
980
|
+
"RangeQueryParameterType object, of 'TIMESTAMP', 'DATE', "
|
|
981
|
+
"or 'DATETIME' type. Got "
|
|
982
|
+
f"{type(range_element_type)}:{range_element_type}"
|
|
983
|
+
)
|
|
984
|
+
|
|
985
|
+
@classmethod
|
|
986
|
+
def _serialize_range_element_value(self, value, type_):
|
|
987
|
+
if value is None or isinstance(value, str):
|
|
988
|
+
return value
|
|
989
|
+
else:
|
|
990
|
+
converter = _SCALAR_VALUE_TO_JSON_PARAM.get(type_)
|
|
991
|
+
if converter is not None:
|
|
992
|
+
return converter(value) # type: ignore
|
|
993
|
+
else:
|
|
994
|
+
raise ValueError(
|
|
995
|
+
f"Cannot convert range element value from type {type_}, "
|
|
996
|
+
"must be one of the strings 'TIMESTAMP', 'DATE' "
|
|
997
|
+
"'DATETIME' or a RangeQueryParameterType object."
|
|
998
|
+
)
|
|
999
|
+
|
|
1000
|
+
def __init__(
|
|
1001
|
+
self,
|
|
1002
|
+
range_element_type,
|
|
1003
|
+
start=None,
|
|
1004
|
+
end=None,
|
|
1005
|
+
name=None,
|
|
1006
|
+
):
|
|
1007
|
+
self.name = name
|
|
1008
|
+
self.range_element_type = self._parse_range_element_type(range_element_type)
|
|
1009
|
+
print(self.range_element_type.type_._type)
|
|
1010
|
+
self.start = start
|
|
1011
|
+
self.end = end
|
|
1012
|
+
|
|
1013
|
+
@classmethod
|
|
1014
|
+
def positional(
|
|
1015
|
+
cls, range_element_type, start=None, end=None
|
|
1016
|
+
) -> "RangeQueryParameter":
|
|
1017
|
+
"""Factory for positional parameters.
|
|
1018
|
+
|
|
1019
|
+
Args:
|
|
1020
|
+
range_element_type (Union[str, RangeQueryParameterType]):
|
|
1021
|
+
The type of range elements. It must be one of `'TIMESTAMP'`,
|
|
1022
|
+
`'DATE'`, or `'DATETIME'`.
|
|
1023
|
+
|
|
1024
|
+
start (Optional[Union[ScalarQueryParameter, str]]):
|
|
1025
|
+
The start of the range value. Must be the same type as
|
|
1026
|
+
range_element_type. If not provided, it's interpreted as
|
|
1027
|
+
UNBOUNDED.
|
|
1028
|
+
|
|
1029
|
+
end (Optional[Union[ScalarQueryParameter, str]]):
|
|
1030
|
+
The end of the range value. Must be the same type as
|
|
1031
|
+
range_element_type. If not provided, it's interpreted as
|
|
1032
|
+
UNBOUNDED.
|
|
1033
|
+
|
|
1034
|
+
Returns:
|
|
1035
|
+
google.cloud.bigquery.query.RangeQueryParameter: Instance without
|
|
1036
|
+
name.
|
|
1037
|
+
"""
|
|
1038
|
+
return cls(range_element_type, start, end)
|
|
1039
|
+
|
|
1040
|
+
@classmethod
|
|
1041
|
+
def from_api_repr(cls, resource: dict) -> "RangeQueryParameter":
|
|
1042
|
+
"""Factory: construct parameter from JSON resource.
|
|
1043
|
+
|
|
1044
|
+
Args:
|
|
1045
|
+
resource (Dict): JSON mapping of parameter
|
|
1046
|
+
|
|
1047
|
+
Returns:
|
|
1048
|
+
google.cloud.bigquery.query.RangeQueryParameter: Instance
|
|
1049
|
+
"""
|
|
1050
|
+
name = resource.get("name")
|
|
1051
|
+
range_element_type = (
|
|
1052
|
+
resource.get("parameterType", {}).get("rangeElementType", {}).get("type")
|
|
1053
|
+
)
|
|
1054
|
+
range_value = resource.get("parameterValue", {}).get("rangeValue", {})
|
|
1055
|
+
start = range_value.get("start", {}).get("value")
|
|
1056
|
+
end = range_value.get("end", {}).get("value")
|
|
1057
|
+
|
|
1058
|
+
return cls(range_element_type, start=start, end=end, name=name)
|
|
1059
|
+
|
|
1060
|
+
def to_api_repr(self) -> dict:
|
|
1061
|
+
"""Construct JSON API representation for the parameter.
|
|
1062
|
+
|
|
1063
|
+
Returns:
|
|
1064
|
+
Dict: JSON mapping
|
|
1065
|
+
"""
|
|
1066
|
+
range_element_type = self.range_element_type.to_api_repr()
|
|
1067
|
+
type_ = self.range_element_type.type_._type
|
|
1068
|
+
start = self._serialize_range_element_value(self.start, type_)
|
|
1069
|
+
end = self._serialize_range_element_value(self.end, type_)
|
|
1070
|
+
resource = {
|
|
1071
|
+
"parameterType": range_element_type,
|
|
1072
|
+
"parameterValue": {
|
|
1073
|
+
"rangeValue": {
|
|
1074
|
+
"start": {"value": start},
|
|
1075
|
+
"end": {"value": end},
|
|
1076
|
+
},
|
|
1077
|
+
},
|
|
1078
|
+
}
|
|
1079
|
+
|
|
1080
|
+
# distinguish between name not provided vs. name being empty string
|
|
1081
|
+
if self.name is not None:
|
|
1082
|
+
resource["name"] = self.name
|
|
1083
|
+
|
|
1084
|
+
return resource
|
|
1085
|
+
|
|
1086
|
+
def _key(self):
|
|
1087
|
+
"""A tuple key that uniquely describes this field.
|
|
1088
|
+
|
|
1089
|
+
Used to compute this instance's hashcode and evaluate equality.
|
|
1090
|
+
|
|
1091
|
+
Returns:
|
|
1092
|
+
Tuple: The contents of this
|
|
1093
|
+
:class:`~google.cloud.bigquery.query.RangeQueryParameter`.
|
|
1094
|
+
"""
|
|
1095
|
+
|
|
1096
|
+
range_element_type = self.range_element_type.to_api_repr()
|
|
1097
|
+
return (self.name, range_element_type, self.start, self.end)
|
|
1098
|
+
|
|
1099
|
+
def __eq__(self, other):
|
|
1100
|
+
if not isinstance(other, RangeQueryParameter):
|
|
1101
|
+
return NotImplemented
|
|
1102
|
+
return self._key() == other._key()
|
|
1103
|
+
|
|
1104
|
+
def __ne__(self, other):
|
|
1105
|
+
return not self == other
|
|
1106
|
+
|
|
1107
|
+
def __repr__(self):
|
|
1108
|
+
return "RangeQueryParameter{}".format(self._key())
|
|
1109
|
+
|
|
1110
|
+
|
|
814
1111
|
class SqlParameterScalarTypes:
|
|
815
1112
|
"""Supported scalar SQL query parameter types as type objects."""
|
|
816
1113
|
|
{google-cloud-bigquery-3.18.0 → google-cloud-bigquery-3.19.0}/google/cloud/bigquery/standard_sql.py
RENAMED
|
@@ -43,6 +43,7 @@ class StandardSqlDataType:
|
|
|
43
43
|
]
|
|
44
44
|
}
|
|
45
45
|
}
|
|
46
|
+
RANGE: {type_kind="RANGE", range_element_type="DATETIME"}
|
|
46
47
|
|
|
47
48
|
Args:
|
|
48
49
|
type_kind:
|
|
@@ -52,6 +53,8 @@ class StandardSqlDataType:
|
|
|
52
53
|
The type of the array's elements, if type_kind is ARRAY.
|
|
53
54
|
struct_type:
|
|
54
55
|
The fields of this struct, in order, if type_kind is STRUCT.
|
|
56
|
+
range_element_type:
|
|
57
|
+
The type of the range's elements, if type_kind is RANGE.
|
|
55
58
|
"""
|
|
56
59
|
|
|
57
60
|
def __init__(
|
|
@@ -61,12 +64,14 @@ class StandardSqlDataType:
|
|
|
61
64
|
] = StandardSqlTypeNames.TYPE_KIND_UNSPECIFIED,
|
|
62
65
|
array_element_type: Optional["StandardSqlDataType"] = None,
|
|
63
66
|
struct_type: Optional["StandardSqlStructType"] = None,
|
|
67
|
+
range_element_type: Optional["StandardSqlDataType"] = None,
|
|
64
68
|
):
|
|
65
69
|
self._properties: Dict[str, Any] = {}
|
|
66
70
|
|
|
67
71
|
self.type_kind = type_kind
|
|
68
72
|
self.array_element_type = array_element_type
|
|
69
73
|
self.struct_type = struct_type
|
|
74
|
+
self.range_element_type = range_element_type
|
|
70
75
|
|
|
71
76
|
@property
|
|
72
77
|
def type_kind(self) -> Optional[StandardSqlTypeNames]:
|
|
@@ -127,6 +132,28 @@ class StandardSqlDataType:
|
|
|
127
132
|
else:
|
|
128
133
|
self._properties["structType"] = struct_type
|
|
129
134
|
|
|
135
|
+
@property
|
|
136
|
+
def range_element_type(self) -> Optional["StandardSqlDataType"]:
|
|
137
|
+
"""The type of the range's elements, if type_kind = "RANGE". Must be
|
|
138
|
+
one of DATETIME, DATE, or TIMESTAMP."""
|
|
139
|
+
range_element_info = self._properties.get("rangeElementType")
|
|
140
|
+
|
|
141
|
+
if range_element_info is None:
|
|
142
|
+
return None
|
|
143
|
+
|
|
144
|
+
result = StandardSqlDataType()
|
|
145
|
+
result._properties = range_element_info # We do not use a copy on purpose.
|
|
146
|
+
return result
|
|
147
|
+
|
|
148
|
+
@range_element_type.setter
|
|
149
|
+
def range_element_type(self, value: Optional["StandardSqlDataType"]):
|
|
150
|
+
range_element_type = None if value is None else value.to_api_repr()
|
|
151
|
+
|
|
152
|
+
if range_element_type is None:
|
|
153
|
+
self._properties.pop("rangeElementType", None)
|
|
154
|
+
else:
|
|
155
|
+
self._properties["rangeElementType"] = range_element_type
|
|
156
|
+
|
|
130
157
|
def to_api_repr(self) -> Dict[str, Any]:
|
|
131
158
|
"""Construct the API resource representation of this SQL data type."""
|
|
132
159
|
return copy.deepcopy(self._properties)
|
|
@@ -155,7 +182,13 @@ class StandardSqlDataType:
|
|
|
155
182
|
if struct_info:
|
|
156
183
|
struct_type = StandardSqlStructType.from_api_repr(struct_info)
|
|
157
184
|
|
|
158
|
-
|
|
185
|
+
range_element_type = None
|
|
186
|
+
if type_kind == StandardSqlTypeNames.RANGE:
|
|
187
|
+
range_element_info = resource.get("rangeElementType")
|
|
188
|
+
if range_element_info:
|
|
189
|
+
range_element_type = cls.from_api_repr(range_element_info)
|
|
190
|
+
|
|
191
|
+
return cls(type_kind, array_element_type, struct_type, range_element_type)
|
|
159
192
|
|
|
160
193
|
def __eq__(self, other):
|
|
161
194
|
if not isinstance(other, StandardSqlDataType):
|
|
@@ -165,6 +198,7 @@ class StandardSqlDataType:
|
|
|
165
198
|
self.type_kind == other.type_kind
|
|
166
199
|
and self.array_element_type == other.array_element_type
|
|
167
200
|
and self.struct_type == other.struct_type
|
|
201
|
+
and self.range_element_type == other.range_element_type
|
|
168
202
|
)
|
|
169
203
|
|
|
170
204
|
def __str__(self):
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: google-cloud-bigquery
|
|
3
|
-
Version: 3.
|
|
3
|
+
Version: 3.19.0
|
|
4
4
|
Summary: Google BigQuery API client library
|
|
5
5
|
Home-page: https://github.com/googleapis/python-bigquery
|
|
6
6
|
Author: Google LLC
|
|
@@ -22,7 +22,8 @@ Classifier: Operating System :: OS Independent
|
|
|
22
22
|
Classifier: Topic :: Internet
|
|
23
23
|
Requires-Python: >=3.7
|
|
24
24
|
License-File: LICENSE
|
|
25
|
-
Requires-Dist: google-api-core!=2.0.*,!=2.1.*,!=2.2.*,!=2.3.
|
|
25
|
+
Requires-Dist: google-api-core[grpc]!=2.0.*,!=2.1.*,!=2.10.*,!=2.2.*,!=2.3.*,!=2.4.*,!=2.5.*,!=2.6.*,!=2.7.*,!=2.8.*,!=2.9.*,<3.0.0dev,>=1.34.1
|
|
26
|
+
Requires-Dist: google-auth<3.0.0dev,>=2.14.1
|
|
26
27
|
Requires-Dist: google-cloud-core<3.0.0dev,>=1.6.0
|
|
27
28
|
Requires-Dist: google-resumable-media<3.0dev,>=0.6.0
|
|
28
29
|
Requires-Dist: packaging>=20.0.0
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
google-api-core!=2.0.*,!=2.1.*,!=2.2.*,!=2.3.
|
|
1
|
+
google-api-core[grpc]!=2.0.*,!=2.1.*,!=2.10.*,!=2.2.*,!=2.3.*,!=2.4.*,!=2.5.*,!=2.6.*,!=2.7.*,!=2.8.*,!=2.9.*,<3.0.0dev,>=1.34.1
|
|
2
|
+
google-auth<3.0.0dev,>=2.14.1
|
|
2
3
|
google-cloud-core<3.0.0dev,>=1.6.0
|
|
3
4
|
google-resumable-media<3.0dev,>=0.6.0
|
|
4
5
|
packaging>=20.0.0
|
|
@@ -32,7 +32,8 @@ dependencies = [
|
|
|
32
32
|
# NOTE: Maintainers, please do not require google-api-core>=2.x.x
|
|
33
33
|
# Until this issue is closed
|
|
34
34
|
# https://github.com/googleapis/google-cloud-python/issues/10566
|
|
35
|
-
"google-api-core >= 1.
|
|
35
|
+
"google-api-core[grpc] >= 1.34.1, <3.0.0dev,!=2.0.*,!=2.1.*,!=2.2.*,!=2.3.*,!=2.4.*,!=2.5.*,!=2.6.*,!=2.7.*,!=2.8.*,!=2.9.*,!=2.10.*",
|
|
36
|
+
"google-auth >= 2.14.1, <3.0.0dev",
|
|
36
37
|
# NOTE: Maintainers, please do not require google-cloud-core>=2.x.x
|
|
37
38
|
# Until this issue is closed
|
|
38
39
|
# https://github.com/googleapis/google-cloud-python/issues/10566
|
|
@@ -2193,6 +2193,44 @@ class TestBigQuery(unittest.TestCase):
|
|
|
2193
2193
|
assert len(rows) == 1
|
|
2194
2194
|
assert rows[0].max_value == 100.0
|
|
2195
2195
|
|
|
2196
|
+
def test_create_routine_with_range(self):
|
|
2197
|
+
routine_name = "routine_range"
|
|
2198
|
+
dataset = self.temp_dataset(_make_dataset_id("routine_range"))
|
|
2199
|
+
|
|
2200
|
+
routine = bigquery.Routine(
|
|
2201
|
+
dataset.routine(routine_name),
|
|
2202
|
+
type_="SCALAR_FUNCTION",
|
|
2203
|
+
language="SQL",
|
|
2204
|
+
body="RANGE_START(x)",
|
|
2205
|
+
arguments=[
|
|
2206
|
+
bigquery.RoutineArgument(
|
|
2207
|
+
name="x",
|
|
2208
|
+
data_type=bigquery.StandardSqlDataType(
|
|
2209
|
+
type_kind=bigquery.StandardSqlTypeNames.RANGE,
|
|
2210
|
+
range_element_type=bigquery.StandardSqlDataType(
|
|
2211
|
+
type_kind=bigquery.StandardSqlTypeNames.DATE
|
|
2212
|
+
),
|
|
2213
|
+
),
|
|
2214
|
+
)
|
|
2215
|
+
],
|
|
2216
|
+
return_type=bigquery.StandardSqlDataType(
|
|
2217
|
+
type_kind=bigquery.StandardSqlTypeNames.DATE
|
|
2218
|
+
),
|
|
2219
|
+
)
|
|
2220
|
+
|
|
2221
|
+
query_string = (
|
|
2222
|
+
"SELECT `{}`(RANGE<DATE> '[2016-08-12, UNBOUNDED)') as range_start;".format(
|
|
2223
|
+
str(routine.reference)
|
|
2224
|
+
)
|
|
2225
|
+
)
|
|
2226
|
+
|
|
2227
|
+
routine = helpers.retry_403(Config.CLIENT.create_routine)(routine)
|
|
2228
|
+
query_job = helpers.retry_403(Config.CLIENT.query)(query_string)
|
|
2229
|
+
rows = list(query_job.result())
|
|
2230
|
+
|
|
2231
|
+
assert len(rows) == 1
|
|
2232
|
+
assert rows[0].range_start == datetime.date(2016, 8, 12)
|
|
2233
|
+
|
|
2196
2234
|
def test_create_tvf_routine(self):
|
|
2197
2235
|
from google.cloud.bigquery import (
|
|
2198
2236
|
Routine,
|