google-cloud-bigquery 3.23.0__tar.gz → 3.24.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.23.0/google_cloud_bigquery.egg-info → google-cloud-bigquery-3.24.0}/PKG-INFO +1 -1
- {google-cloud-bigquery-3.23.0 → google-cloud-bigquery-3.24.0}/google/cloud/bigquery/_helpers.py +2 -0
- {google-cloud-bigquery-3.23.0 → google-cloud-bigquery-3.24.0}/google/cloud/bigquery/_job_helpers.py +8 -5
- {google-cloud-bigquery-3.23.0 → google-cloud-bigquery-3.24.0}/google/cloud/bigquery/client.py +17 -11
- {google-cloud-bigquery-3.23.0 → google-cloud-bigquery-3.24.0}/google/cloud/bigquery/format_options.py +15 -0
- {google-cloud-bigquery-3.23.0 → google-cloud-bigquery-3.24.0}/google/cloud/bigquery/job/base.py +12 -17
- {google-cloud-bigquery-3.23.0 → google-cloud-bigquery-3.24.0}/google/cloud/bigquery/job/query.py +64 -14
- {google-cloud-bigquery-3.23.0 → google-cloud-bigquery-3.24.0}/google/cloud/bigquery/retry.py +19 -0
- {google-cloud-bigquery-3.23.0 → google-cloud-bigquery-3.24.0}/google/cloud/bigquery/table.py +16 -2
- {google-cloud-bigquery-3.23.0 → google-cloud-bigquery-3.24.0}/google/cloud/bigquery/version.py +1 -1
- {google-cloud-bigquery-3.23.0 → google-cloud-bigquery-3.24.0/google_cloud_bigquery.egg-info}/PKG-INFO +1 -1
- {google-cloud-bigquery-3.23.0 → google-cloud-bigquery-3.24.0}/tests/unit/job/test_base.py +71 -15
- {google-cloud-bigquery-3.23.0 → google-cloud-bigquery-3.24.0}/tests/unit/job/test_copy.py +30 -4
- {google-cloud-bigquery-3.23.0 → google-cloud-bigquery-3.24.0}/tests/unit/job/test_extract.py +28 -4
- {google-cloud-bigquery-3.23.0 → google-cloud-bigquery-3.24.0}/tests/unit/job/test_load.py +39 -8
- {google-cloud-bigquery-3.23.0 → google-cloud-bigquery-3.24.0}/tests/unit/job/test_query.py +274 -111
- {google-cloud-bigquery-3.23.0 → google-cloud-bigquery-3.24.0}/tests/unit/test__job_helpers.py +19 -41
- {google-cloud-bigquery-3.23.0 → google-cloud-bigquery-3.24.0}/tests/unit/test_client.py +150 -2
- {google-cloud-bigquery-3.23.0 → google-cloud-bigquery-3.24.0}/tests/unit/test_format_options.py +7 -1
- {google-cloud-bigquery-3.23.0 → google-cloud-bigquery-3.24.0}/tests/unit/test_job_retry.py +206 -83
- {google-cloud-bigquery-3.23.0 → google-cloud-bigquery-3.24.0}/tests/unit/test_table.py +18 -3
- {google-cloud-bigquery-3.23.0 → google-cloud-bigquery-3.24.0}/LICENSE +0 -0
- {google-cloud-bigquery-3.23.0 → google-cloud-bigquery-3.24.0}/MANIFEST.in +0 -0
- {google-cloud-bigquery-3.23.0 → google-cloud-bigquery-3.24.0}/README.rst +0 -0
- {google-cloud-bigquery-3.23.0 → google-cloud-bigquery-3.24.0}/google/cloud/bigquery/__init__.py +0 -0
- {google-cloud-bigquery-3.23.0 → google-cloud-bigquery-3.24.0}/google/cloud/bigquery/_http.py +0 -0
- {google-cloud-bigquery-3.23.0 → google-cloud-bigquery-3.24.0}/google/cloud/bigquery/_pandas_helpers.py +0 -0
- {google-cloud-bigquery-3.23.0 → google-cloud-bigquery-3.24.0}/google/cloud/bigquery/_pyarrow_helpers.py +0 -0
- {google-cloud-bigquery-3.23.0 → google-cloud-bigquery-3.24.0}/google/cloud/bigquery/_tqdm_helpers.py +0 -0
- {google-cloud-bigquery-3.23.0 → google-cloud-bigquery-3.24.0}/google/cloud/bigquery/_versions_helpers.py +0 -0
- {google-cloud-bigquery-3.23.0 → google-cloud-bigquery-3.24.0}/google/cloud/bigquery/dataset.py +0 -0
- {google-cloud-bigquery-3.23.0 → google-cloud-bigquery-3.24.0}/google/cloud/bigquery/dbapi/__init__.py +0 -0
- {google-cloud-bigquery-3.23.0 → google-cloud-bigquery-3.24.0}/google/cloud/bigquery/dbapi/_helpers.py +0 -0
- {google-cloud-bigquery-3.23.0 → google-cloud-bigquery-3.24.0}/google/cloud/bigquery/dbapi/connection.py +0 -0
- {google-cloud-bigquery-3.23.0 → google-cloud-bigquery-3.24.0}/google/cloud/bigquery/dbapi/cursor.py +0 -0
- {google-cloud-bigquery-3.23.0 → google-cloud-bigquery-3.24.0}/google/cloud/bigquery/dbapi/exceptions.py +0 -0
- {google-cloud-bigquery-3.23.0 → google-cloud-bigquery-3.24.0}/google/cloud/bigquery/dbapi/types.py +0 -0
- {google-cloud-bigquery-3.23.0 → google-cloud-bigquery-3.24.0}/google/cloud/bigquery/encryption_configuration.py +0 -0
- {google-cloud-bigquery-3.23.0 → google-cloud-bigquery-3.24.0}/google/cloud/bigquery/enums.py +0 -0
- {google-cloud-bigquery-3.23.0 → google-cloud-bigquery-3.24.0}/google/cloud/bigquery/exceptions.py +0 -0
- {google-cloud-bigquery-3.23.0 → google-cloud-bigquery-3.24.0}/google/cloud/bigquery/external_config.py +0 -0
- {google-cloud-bigquery-3.23.0 → google-cloud-bigquery-3.24.0}/google/cloud/bigquery/iam.py +0 -0
- {google-cloud-bigquery-3.23.0 → google-cloud-bigquery-3.24.0}/google/cloud/bigquery/job/__init__.py +0 -0
- {google-cloud-bigquery-3.23.0 → google-cloud-bigquery-3.24.0}/google/cloud/bigquery/job/copy_.py +0 -0
- {google-cloud-bigquery-3.23.0 → google-cloud-bigquery-3.24.0}/google/cloud/bigquery/job/extract.py +0 -0
- {google-cloud-bigquery-3.23.0 → google-cloud-bigquery-3.24.0}/google/cloud/bigquery/job/load.py +0 -0
- {google-cloud-bigquery-3.23.0 → google-cloud-bigquery-3.24.0}/google/cloud/bigquery/magics/__init__.py +0 -0
- {google-cloud-bigquery-3.23.0 → google-cloud-bigquery-3.24.0}/google/cloud/bigquery/magics/line_arg_parser/__init__.py +0 -0
- {google-cloud-bigquery-3.23.0 → google-cloud-bigquery-3.24.0}/google/cloud/bigquery/magics/line_arg_parser/exceptions.py +0 -0
- {google-cloud-bigquery-3.23.0 → google-cloud-bigquery-3.24.0}/google/cloud/bigquery/magics/line_arg_parser/lexer.py +0 -0
- {google-cloud-bigquery-3.23.0 → google-cloud-bigquery-3.24.0}/google/cloud/bigquery/magics/line_arg_parser/parser.py +0 -0
- {google-cloud-bigquery-3.23.0 → google-cloud-bigquery-3.24.0}/google/cloud/bigquery/magics/line_arg_parser/visitors.py +0 -0
- {google-cloud-bigquery-3.23.0 → google-cloud-bigquery-3.24.0}/google/cloud/bigquery/magics/magics.py +0 -0
- {google-cloud-bigquery-3.23.0 → google-cloud-bigquery-3.24.0}/google/cloud/bigquery/model.py +0 -0
- {google-cloud-bigquery-3.23.0 → google-cloud-bigquery-3.24.0}/google/cloud/bigquery/opentelemetry_tracing.py +0 -0
- {google-cloud-bigquery-3.23.0 → google-cloud-bigquery-3.24.0}/google/cloud/bigquery/py.typed +0 -0
- {google-cloud-bigquery-3.23.0 → google-cloud-bigquery-3.24.0}/google/cloud/bigquery/query.py +0 -0
- {google-cloud-bigquery-3.23.0 → google-cloud-bigquery-3.24.0}/google/cloud/bigquery/routine/__init__.py +0 -0
- {google-cloud-bigquery-3.23.0 → google-cloud-bigquery-3.24.0}/google/cloud/bigquery/routine/routine.py +0 -0
- {google-cloud-bigquery-3.23.0 → google-cloud-bigquery-3.24.0}/google/cloud/bigquery/schema.py +0 -0
- {google-cloud-bigquery-3.23.0 → google-cloud-bigquery-3.24.0}/google/cloud/bigquery/standard_sql.py +0 -0
- {google-cloud-bigquery-3.23.0 → google-cloud-bigquery-3.24.0}/google/cloud/bigquery_v2/__init__.py +0 -0
- {google-cloud-bigquery-3.23.0 → google-cloud-bigquery-3.24.0}/google/cloud/bigquery_v2/types/__init__.py +0 -0
- {google-cloud-bigquery-3.23.0 → google-cloud-bigquery-3.24.0}/google/cloud/bigquery_v2/types/encryption_config.py +0 -0
- {google-cloud-bigquery-3.23.0 → google-cloud-bigquery-3.24.0}/google/cloud/bigquery_v2/types/model.py +0 -0
- {google-cloud-bigquery-3.23.0 → google-cloud-bigquery-3.24.0}/google/cloud/bigquery_v2/types/model_reference.py +0 -0
- {google-cloud-bigquery-3.23.0 → google-cloud-bigquery-3.24.0}/google/cloud/bigquery_v2/types/standard_sql.py +0 -0
- {google-cloud-bigquery-3.23.0 → google-cloud-bigquery-3.24.0}/google/cloud/bigquery_v2/types/table_reference.py +0 -0
- {google-cloud-bigquery-3.23.0 → google-cloud-bigquery-3.24.0}/google_cloud_bigquery.egg-info/SOURCES.txt +0 -0
- {google-cloud-bigquery-3.23.0 → google-cloud-bigquery-3.24.0}/google_cloud_bigquery.egg-info/dependency_links.txt +0 -0
- {google-cloud-bigquery-3.23.0 → google-cloud-bigquery-3.24.0}/google_cloud_bigquery.egg-info/not-zip-safe +0 -0
- {google-cloud-bigquery-3.23.0 → google-cloud-bigquery-3.24.0}/google_cloud_bigquery.egg-info/requires.txt +0 -0
- {google-cloud-bigquery-3.23.0 → google-cloud-bigquery-3.24.0}/google_cloud_bigquery.egg-info/top_level.txt +0 -0
- {google-cloud-bigquery-3.23.0 → google-cloud-bigquery-3.24.0}/setup.cfg +0 -0
- {google-cloud-bigquery-3.23.0 → google-cloud-bigquery-3.24.0}/setup.py +0 -0
- {google-cloud-bigquery-3.23.0 → google-cloud-bigquery-3.24.0}/tests/__init__.py +0 -0
- {google-cloud-bigquery-3.23.0 → google-cloud-bigquery-3.24.0}/tests/data/characters.json +0 -0
- {google-cloud-bigquery-3.23.0 → google-cloud-bigquery-3.24.0}/tests/data/characters.jsonl +0 -0
- {google-cloud-bigquery-3.23.0 → google-cloud-bigquery-3.24.0}/tests/data/colors.avro +0 -0
- {google-cloud-bigquery-3.23.0 → google-cloud-bigquery-3.24.0}/tests/data/numeric_38_12.parquet +0 -0
- {google-cloud-bigquery-3.23.0 → google-cloud-bigquery-3.24.0}/tests/data/people.csv +0 -0
- {google-cloud-bigquery-3.23.0 → google-cloud-bigquery-3.24.0}/tests/data/scalars.csv +0 -0
- {google-cloud-bigquery-3.23.0 → google-cloud-bigquery-3.24.0}/tests/data/scalars.jsonl +0 -0
- {google-cloud-bigquery-3.23.0 → google-cloud-bigquery-3.24.0}/tests/data/scalars_extreme.jsonl +0 -0
- {google-cloud-bigquery-3.23.0 → google-cloud-bigquery-3.24.0}/tests/data/scalars_schema.json +0 -0
- {google-cloud-bigquery-3.23.0 → google-cloud-bigquery-3.24.0}/tests/data/scalars_schema_csv.json +0 -0
- {google-cloud-bigquery-3.23.0 → google-cloud-bigquery-3.24.0}/tests/data/schema.json +0 -0
- {google-cloud-bigquery-3.23.0 → google-cloud-bigquery-3.24.0}/tests/scrub_datasets.py +0 -0
- {google-cloud-bigquery-3.23.0 → google-cloud-bigquery-3.24.0}/tests/system/__init__.py +0 -0
- {google-cloud-bigquery-3.23.0 → google-cloud-bigquery-3.24.0}/tests/system/conftest.py +0 -0
- {google-cloud-bigquery-3.23.0 → google-cloud-bigquery-3.24.0}/tests/system/helpers.py +0 -0
- {google-cloud-bigquery-3.23.0 → google-cloud-bigquery-3.24.0}/tests/system/test_arrow.py +0 -0
- {google-cloud-bigquery-3.23.0 → google-cloud-bigquery-3.24.0}/tests/system/test_client.py +0 -0
- {google-cloud-bigquery-3.23.0 → google-cloud-bigquery-3.24.0}/tests/system/test_job_retry.py +0 -0
- {google-cloud-bigquery-3.23.0 → google-cloud-bigquery-3.24.0}/tests/system/test_list_rows.py +0 -0
- {google-cloud-bigquery-3.23.0 → google-cloud-bigquery-3.24.0}/tests/system/test_magics.py +0 -0
- {google-cloud-bigquery-3.23.0 → google-cloud-bigquery-3.24.0}/tests/system/test_pandas.py +0 -0
- {google-cloud-bigquery-3.23.0 → google-cloud-bigquery-3.24.0}/tests/system/test_query.py +0 -0
- {google-cloud-bigquery-3.23.0 → google-cloud-bigquery-3.24.0}/tests/system/test_structs.py +0 -0
- {google-cloud-bigquery-3.23.0 → google-cloud-bigquery-3.24.0}/tests/unit/__init__.py +0 -0
- {google-cloud-bigquery-3.23.0 → google-cloud-bigquery-3.24.0}/tests/unit/_helpers/__init__.py +0 -0
- {google-cloud-bigquery-3.23.0 → google-cloud-bigquery-3.24.0}/tests/unit/_helpers/test_from_json.py +0 -0
- {google-cloud-bigquery-3.23.0 → google-cloud-bigquery-3.24.0}/tests/unit/conftest.py +0 -0
- {google-cloud-bigquery-3.23.0 → google-cloud-bigquery-3.24.0}/tests/unit/helpers.py +0 -0
- {google-cloud-bigquery-3.23.0 → google-cloud-bigquery-3.24.0}/tests/unit/job/__init__.py +0 -0
- {google-cloud-bigquery-3.23.0 → google-cloud-bigquery-3.24.0}/tests/unit/job/helpers.py +0 -0
- {google-cloud-bigquery-3.23.0 → google-cloud-bigquery-3.24.0}/tests/unit/job/test_load_config.py +0 -0
- {google-cloud-bigquery-3.23.0 → google-cloud-bigquery-3.24.0}/tests/unit/job/test_query_config.py +0 -0
- {google-cloud-bigquery-3.23.0 → google-cloud-bigquery-3.24.0}/tests/unit/job/test_query_pandas.py +0 -0
- {google-cloud-bigquery-3.23.0 → google-cloud-bigquery-3.24.0}/tests/unit/job/test_query_stats.py +0 -0
- {google-cloud-bigquery-3.23.0 → google-cloud-bigquery-3.24.0}/tests/unit/line_arg_parser/__init__.py +0 -0
- {google-cloud-bigquery-3.23.0 → google-cloud-bigquery-3.24.0}/tests/unit/line_arg_parser/test_lexer.py +0 -0
- {google-cloud-bigquery-3.23.0 → google-cloud-bigquery-3.24.0}/tests/unit/line_arg_parser/test_parser.py +0 -0
- {google-cloud-bigquery-3.23.0 → google-cloud-bigquery-3.24.0}/tests/unit/line_arg_parser/test_visitors.py +0 -0
- {google-cloud-bigquery-3.23.0 → google-cloud-bigquery-3.24.0}/tests/unit/model/__init__.py +0 -0
- {google-cloud-bigquery-3.23.0 → google-cloud-bigquery-3.24.0}/tests/unit/model/test_model.py +0 -0
- {google-cloud-bigquery-3.23.0 → google-cloud-bigquery-3.24.0}/tests/unit/model/test_model_reference.py +0 -0
- {google-cloud-bigquery-3.23.0 → google-cloud-bigquery-3.24.0}/tests/unit/routine/__init__.py +0 -0
- {google-cloud-bigquery-3.23.0 → google-cloud-bigquery-3.24.0}/tests/unit/routine/test_remote_function_options.py +0 -0
- {google-cloud-bigquery-3.23.0 → google-cloud-bigquery-3.24.0}/tests/unit/routine/test_routine.py +0 -0
- {google-cloud-bigquery-3.23.0 → google-cloud-bigquery-3.24.0}/tests/unit/routine/test_routine_argument.py +0 -0
- {google-cloud-bigquery-3.23.0 → google-cloud-bigquery-3.24.0}/tests/unit/routine/test_routine_reference.py +0 -0
- {google-cloud-bigquery-3.23.0 → google-cloud-bigquery-3.24.0}/tests/unit/test__helpers.py +0 -0
- {google-cloud-bigquery-3.23.0 → google-cloud-bigquery-3.24.0}/tests/unit/test__http.py +0 -0
- {google-cloud-bigquery-3.23.0 → google-cloud-bigquery-3.24.0}/tests/unit/test__pandas_helpers.py +0 -0
- {google-cloud-bigquery-3.23.0 → google-cloud-bigquery-3.24.0}/tests/unit/test__pyarrow_helpers.py +0 -0
- {google-cloud-bigquery-3.23.0 → google-cloud-bigquery-3.24.0}/tests/unit/test__versions_helpers.py +0 -0
- {google-cloud-bigquery-3.23.0 → google-cloud-bigquery-3.24.0}/tests/unit/test_create_dataset.py +0 -0
- {google-cloud-bigquery-3.23.0 → google-cloud-bigquery-3.24.0}/tests/unit/test_dataset.py +0 -0
- {google-cloud-bigquery-3.23.0 → google-cloud-bigquery-3.24.0}/tests/unit/test_dbapi__helpers.py +0 -0
- {google-cloud-bigquery-3.23.0 → google-cloud-bigquery-3.24.0}/tests/unit/test_dbapi_connection.py +0 -0
- {google-cloud-bigquery-3.23.0 → google-cloud-bigquery-3.24.0}/tests/unit/test_dbapi_cursor.py +0 -0
- {google-cloud-bigquery-3.23.0 → google-cloud-bigquery-3.24.0}/tests/unit/test_dbapi_types.py +0 -0
- {google-cloud-bigquery-3.23.0 → google-cloud-bigquery-3.24.0}/tests/unit/test_delete_dataset.py +0 -0
- {google-cloud-bigquery-3.23.0 → google-cloud-bigquery-3.24.0}/tests/unit/test_encryption_configuration.py +0 -0
- {google-cloud-bigquery-3.23.0 → google-cloud-bigquery-3.24.0}/tests/unit/test_external_config.py +0 -0
- {google-cloud-bigquery-3.23.0 → google-cloud-bigquery-3.24.0}/tests/unit/test_legacy_types.py +0 -0
- {google-cloud-bigquery-3.23.0 → google-cloud-bigquery-3.24.0}/tests/unit/test_list_datasets.py +0 -0
- {google-cloud-bigquery-3.23.0 → google-cloud-bigquery-3.24.0}/tests/unit/test_list_jobs.py +0 -0
- {google-cloud-bigquery-3.23.0 → google-cloud-bigquery-3.24.0}/tests/unit/test_list_models.py +0 -0
- {google-cloud-bigquery-3.23.0 → google-cloud-bigquery-3.24.0}/tests/unit/test_list_projects.py +0 -0
- {google-cloud-bigquery-3.23.0 → google-cloud-bigquery-3.24.0}/tests/unit/test_list_routines.py +0 -0
- {google-cloud-bigquery-3.23.0 → google-cloud-bigquery-3.24.0}/tests/unit/test_list_tables.py +0 -0
- {google-cloud-bigquery-3.23.0 → google-cloud-bigquery-3.24.0}/tests/unit/test_magics.py +0 -0
- {google-cloud-bigquery-3.23.0 → google-cloud-bigquery-3.24.0}/tests/unit/test_opentelemetry_tracing.py +0 -0
- {google-cloud-bigquery-3.23.0 → google-cloud-bigquery-3.24.0}/tests/unit/test_packaging.py +0 -0
- {google-cloud-bigquery-3.23.0 → google-cloud-bigquery-3.24.0}/tests/unit/test_query.py +0 -0
- {google-cloud-bigquery-3.23.0 → google-cloud-bigquery-3.24.0}/tests/unit/test_retry.py +0 -0
- {google-cloud-bigquery-3.23.0 → google-cloud-bigquery-3.24.0}/tests/unit/test_schema.py +0 -0
- {google-cloud-bigquery-3.23.0 → google-cloud-bigquery-3.24.0}/tests/unit/test_signature_compatibility.py +0 -0
- {google-cloud-bigquery-3.23.0 → google-cloud-bigquery-3.24.0}/tests/unit/test_standard_sql_types.py +0 -0
- {google-cloud-bigquery-3.23.0 → google-cloud-bigquery-3.24.0}/tests/unit/test_table_arrow.py +0 -0
- {google-cloud-bigquery-3.23.0 → google-cloud-bigquery-3.24.0}/tests/unit/test_table_pandas.py +0 -0
{google-cloud-bigquery-3.23.0 → google-cloud-bigquery-3.24.0}/google/cloud/bigquery/_helpers.py
RENAMED
|
@@ -33,6 +33,8 @@ from google.cloud._helpers import _to_bytes
|
|
|
33
33
|
from google.auth import credentials as ga_credentials # type: ignore
|
|
34
34
|
from google.api_core import client_options as client_options_lib
|
|
35
35
|
|
|
36
|
+
TimeoutType = Union[float, None]
|
|
37
|
+
|
|
36
38
|
_RFC3339_MICROS_NO_ZULU = "%Y-%m-%dT%H:%M:%S.%f"
|
|
37
39
|
_TIMEONLY_WO_MICROS = "%H:%M:%S"
|
|
38
40
|
_TIMEONLY_W_MICROS = "%H:%M:%S.%f"
|
{google-cloud-bigquery-3.23.0 → google-cloud-bigquery-3.24.0}/google/cloud/bigquery/_job_helpers.py
RENAMED
|
@@ -39,7 +39,7 @@ import copy
|
|
|
39
39
|
import functools
|
|
40
40
|
import os
|
|
41
41
|
import uuid
|
|
42
|
-
from typing import Any, Dict, TYPE_CHECKING,
|
|
42
|
+
from typing import Any, Dict, Optional, TYPE_CHECKING, Union
|
|
43
43
|
|
|
44
44
|
import google.api_core.exceptions as core_exceptions
|
|
45
45
|
from google.api_core import retry as retries
|
|
@@ -47,6 +47,7 @@ from google.api_core import retry as retries
|
|
|
47
47
|
from google.cloud.bigquery import job
|
|
48
48
|
import google.cloud.bigquery.query
|
|
49
49
|
from google.cloud.bigquery import table
|
|
50
|
+
from google.cloud.bigquery.retry import POLLING_DEFAULT_VALUE
|
|
50
51
|
|
|
51
52
|
# Avoid circular imports
|
|
52
53
|
if TYPE_CHECKING: # pragma: NO COVER
|
|
@@ -328,7 +329,7 @@ def query_and_wait(
|
|
|
328
329
|
location: Optional[str],
|
|
329
330
|
project: str,
|
|
330
331
|
api_timeout: Optional[float] = None,
|
|
331
|
-
wait_timeout: Optional[float] =
|
|
332
|
+
wait_timeout: Optional[Union[float, object]] = POLLING_DEFAULT_VALUE,
|
|
332
333
|
retry: Optional[retries.Retry],
|
|
333
334
|
job_retry: Optional[retries.Retry],
|
|
334
335
|
page_size: Optional[int] = None,
|
|
@@ -364,10 +365,12 @@ def query_and_wait(
|
|
|
364
365
|
api_timeout (Optional[float]):
|
|
365
366
|
The number of seconds to wait for the underlying HTTP transport
|
|
366
367
|
before using ``retry``.
|
|
367
|
-
wait_timeout (Optional[float]):
|
|
368
|
+
wait_timeout (Optional[Union[float, object]]):
|
|
368
369
|
The number of seconds to wait for the query to finish. If the
|
|
369
370
|
query doesn't finish before this timeout, the client attempts
|
|
370
|
-
to cancel the query.
|
|
371
|
+
to cancel the query. If unset, the underlying Client.get_job() API
|
|
372
|
+
call has timeout, but we still wait indefinitely for the job to
|
|
373
|
+
finish.
|
|
371
374
|
retry (Optional[google.api_core.retry.Retry]):
|
|
372
375
|
How to retry the RPC. This only applies to making RPC
|
|
373
376
|
calls. It isn't used to retry failed jobs. This has
|
|
@@ -545,7 +548,7 @@ def _supported_by_jobs_query(request_body: Dict[str, Any]) -> bool:
|
|
|
545
548
|
def _wait_or_cancel(
|
|
546
549
|
job: job.QueryJob,
|
|
547
550
|
api_timeout: Optional[float],
|
|
548
|
-
wait_timeout: Optional[float],
|
|
551
|
+
wait_timeout: Optional[Union[object, float]],
|
|
549
552
|
retry: Optional[retries.Retry],
|
|
550
553
|
page_size: Optional[int],
|
|
551
554
|
max_results: Optional[int],
|
{google-cloud-bigquery-3.23.0 → google-cloud-bigquery-3.24.0}/google/cloud/bigquery/client.py
RENAMED
|
@@ -82,6 +82,7 @@ from google.cloud.bigquery._helpers import _DEFAULT_HOST_TEMPLATE
|
|
|
82
82
|
from google.cloud.bigquery._helpers import _DEFAULT_UNIVERSE
|
|
83
83
|
from google.cloud.bigquery._helpers import _validate_universe
|
|
84
84
|
from google.cloud.bigquery._helpers import _get_client_universe
|
|
85
|
+
from google.cloud.bigquery._helpers import TimeoutType
|
|
85
86
|
from google.cloud.bigquery._job_helpers import make_job_id as _make_job_id
|
|
86
87
|
from google.cloud.bigquery.dataset import Dataset
|
|
87
88
|
from google.cloud.bigquery.dataset import DatasetListItem
|
|
@@ -107,6 +108,8 @@ from google.cloud.bigquery.retry import (
|
|
|
107
108
|
DEFAULT_JOB_RETRY,
|
|
108
109
|
DEFAULT_RETRY,
|
|
109
110
|
DEFAULT_TIMEOUT,
|
|
111
|
+
DEFAULT_GET_JOB_TIMEOUT,
|
|
112
|
+
POLLING_DEFAULT_VALUE,
|
|
110
113
|
)
|
|
111
114
|
from google.cloud.bigquery.routine import Routine
|
|
112
115
|
from google.cloud.bigquery.routine import RoutineReference
|
|
@@ -123,7 +126,6 @@ pandas = (
|
|
|
123
126
|
_versions_helpers.PANDAS_VERSIONS.try_import()
|
|
124
127
|
) # mypy check fails because pandas import is outside module, there are type: ignore comments related to this
|
|
125
128
|
|
|
126
|
-
TimeoutType = Union[float, None]
|
|
127
129
|
ResumableTimeoutType = Union[
|
|
128
130
|
None, float, Tuple[float, float]
|
|
129
131
|
] # for resumable media methods
|
|
@@ -1962,6 +1964,7 @@ class Client(ClientWithProject):
|
|
|
1962
1964
|
timeout_ms: Optional[int] = None,
|
|
1963
1965
|
location: Optional[str] = None,
|
|
1964
1966
|
timeout: TimeoutType = DEFAULT_TIMEOUT,
|
|
1967
|
+
page_size: int = 0,
|
|
1965
1968
|
) -> _QueryResults:
|
|
1966
1969
|
"""Get the query results object for a query job.
|
|
1967
1970
|
|
|
@@ -1980,13 +1983,16 @@ class Client(ClientWithProject):
|
|
|
1980
1983
|
before using ``retry``. If set, this connection timeout may be
|
|
1981
1984
|
increased to a minimum value. This prevents retries on what
|
|
1982
1985
|
would otherwise be a successful response.
|
|
1986
|
+
page_size (int):
|
|
1987
|
+
Maximum number of rows in a single response. See maxResults in
|
|
1988
|
+
the jobs.getQueryResults REST API.
|
|
1983
1989
|
|
|
1984
1990
|
Returns:
|
|
1985
1991
|
google.cloud.bigquery.query._QueryResults:
|
|
1986
1992
|
A new ``_QueryResults`` instance.
|
|
1987
1993
|
"""
|
|
1988
1994
|
|
|
1989
|
-
extra_params: Dict[str, Any] = {"maxResults":
|
|
1995
|
+
extra_params: Dict[str, Any] = {"maxResults": page_size}
|
|
1990
1996
|
|
|
1991
1997
|
if timeout is not None:
|
|
1992
1998
|
if not isinstance(timeout, (int, float)):
|
|
@@ -1994,6 +2000,9 @@ class Client(ClientWithProject):
|
|
|
1994
2000
|
else:
|
|
1995
2001
|
timeout = max(timeout, _MIN_GET_QUERY_RESULTS_TIMEOUT)
|
|
1996
2002
|
|
|
2003
|
+
if page_size > 0:
|
|
2004
|
+
extra_params["formatOptions.useInt64Timestamp"] = True
|
|
2005
|
+
|
|
1997
2006
|
if project is None:
|
|
1998
2007
|
project = self.project
|
|
1999
2008
|
|
|
@@ -2139,7 +2148,7 @@ class Client(ClientWithProject):
|
|
|
2139
2148
|
project: Optional[str] = None,
|
|
2140
2149
|
location: Optional[str] = None,
|
|
2141
2150
|
retry: retries.Retry = DEFAULT_RETRY,
|
|
2142
|
-
timeout: TimeoutType =
|
|
2151
|
+
timeout: TimeoutType = DEFAULT_GET_JOB_TIMEOUT,
|
|
2143
2152
|
) -> Union[job.LoadJob, job.CopyJob, job.ExtractJob, job.QueryJob, job.UnknownJob]:
|
|
2144
2153
|
"""Fetch a job for the project associated with this client.
|
|
2145
2154
|
|
|
@@ -3503,7 +3512,7 @@ class Client(ClientWithProject):
|
|
|
3503
3512
|
location: Optional[str] = None,
|
|
3504
3513
|
project: Optional[str] = None,
|
|
3505
3514
|
api_timeout: TimeoutType = DEFAULT_TIMEOUT,
|
|
3506
|
-
wait_timeout:
|
|
3515
|
+
wait_timeout: Union[Optional[float], object] = POLLING_DEFAULT_VALUE,
|
|
3507
3516
|
retry: retries.Retry = DEFAULT_RETRY,
|
|
3508
3517
|
job_retry: retries.Retry = DEFAULT_JOB_RETRY,
|
|
3509
3518
|
page_size: Optional[int] = None,
|
|
@@ -3537,10 +3546,12 @@ class Client(ClientWithProject):
|
|
|
3537
3546
|
api_timeout (Optional[float]):
|
|
3538
3547
|
The number of seconds to wait for the underlying HTTP transport
|
|
3539
3548
|
before using ``retry``.
|
|
3540
|
-
wait_timeout (Optional[float]):
|
|
3549
|
+
wait_timeout (Optional[Union[float, object]]):
|
|
3541
3550
|
The number of seconds to wait for the query to finish. If the
|
|
3542
3551
|
query doesn't finish before this timeout, the client attempts
|
|
3543
|
-
to cancel the query.
|
|
3552
|
+
to cancel the query. If unset, the underlying REST API calls
|
|
3553
|
+
have timeouts, but we still wait indefinitely for the job to
|
|
3554
|
+
finish.
|
|
3544
3555
|
retry (Optional[google.api_core.retry.Retry]):
|
|
3545
3556
|
How to retry the RPC. This only applies to making RPC
|
|
3546
3557
|
calls. It isn't used to retry failed jobs. This has
|
|
@@ -4127,11 +4138,6 @@ class Client(ClientWithProject):
|
|
|
4127
4138
|
if start_index is not None:
|
|
4128
4139
|
params["startIndex"] = start_index
|
|
4129
4140
|
|
|
4130
|
-
# We don't call jobs.query with a page size, so if the user explicitly
|
|
4131
|
-
# requests a certain size, invalidate the cache.
|
|
4132
|
-
if page_size is not None:
|
|
4133
|
-
first_page_response = None
|
|
4134
|
-
|
|
4135
4141
|
params["formatOptions.useInt64Timestamp"] = True
|
|
4136
4142
|
row_iterator = RowIterator(
|
|
4137
4143
|
client=self,
|
|
@@ -105,6 +105,21 @@ class ParquetOptions:
|
|
|
105
105
|
def enable_list_inference(self, value: bool) -> None:
|
|
106
106
|
self._properties["enableListInference"] = value
|
|
107
107
|
|
|
108
|
+
@property
|
|
109
|
+
def map_target_type(self) -> str:
|
|
110
|
+
"""Indicates whether to simplify the representation of parquet maps to only show keys and values."""
|
|
111
|
+
|
|
112
|
+
return self._properties.get("mapTargetType")
|
|
113
|
+
|
|
114
|
+
@map_target_type.setter
|
|
115
|
+
def map_target_type(self, value: str) -> None:
|
|
116
|
+
"""Sets the map target type.
|
|
117
|
+
|
|
118
|
+
Args:
|
|
119
|
+
value: The map target type (eg ARRAY_OF_STRUCT).
|
|
120
|
+
"""
|
|
121
|
+
self._properties["mapTargetType"] = value
|
|
122
|
+
|
|
108
123
|
@classmethod
|
|
109
124
|
def from_api_repr(cls, resource: Dict[str, bool]) -> "ParquetOptions":
|
|
110
125
|
"""Factory: construct an instance from a resource dict.
|
{google-cloud-bigquery-3.23.0 → google-cloud-bigquery-3.24.0}/google/cloud/bigquery/job/base.py
RENAMED
|
@@ -26,8 +26,11 @@ from google.api_core import exceptions
|
|
|
26
26
|
import google.api_core.future.polling
|
|
27
27
|
|
|
28
28
|
from google.cloud.bigquery import _helpers
|
|
29
|
-
from google.cloud.bigquery.retry import DEFAULT_RETRY
|
|
30
29
|
from google.cloud.bigquery._helpers import _int_or_none
|
|
30
|
+
from google.cloud.bigquery.retry import (
|
|
31
|
+
DEFAULT_GET_JOB_TIMEOUT,
|
|
32
|
+
DEFAULT_RETRY,
|
|
33
|
+
)
|
|
31
34
|
|
|
32
35
|
|
|
33
36
|
_DONE_STATE = "DONE"
|
|
@@ -801,7 +804,7 @@ class _AsyncJob(google.api_core.future.polling.PollingFuture):
|
|
|
801
804
|
self,
|
|
802
805
|
client=None,
|
|
803
806
|
retry: "retries.Retry" = DEFAULT_RETRY,
|
|
804
|
-
timeout: Optional[float] =
|
|
807
|
+
timeout: Optional[float] = DEFAULT_GET_JOB_TIMEOUT,
|
|
805
808
|
):
|
|
806
809
|
"""API call: refresh job properties via a GET request.
|
|
807
810
|
|
|
@@ -820,22 +823,14 @@ class _AsyncJob(google.api_core.future.polling.PollingFuture):
|
|
|
820
823
|
"""
|
|
821
824
|
client = self._require_client(client)
|
|
822
825
|
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
api_response = client._call_api(
|
|
829
|
-
retry,
|
|
830
|
-
span_name="BigQuery.job.reload",
|
|
831
|
-
span_attributes=span_attributes,
|
|
832
|
-
job_ref=self,
|
|
833
|
-
method="GET",
|
|
834
|
-
path=self.path,
|
|
835
|
-
query_params=extra_params,
|
|
826
|
+
got_job = client.get_job(
|
|
827
|
+
self,
|
|
828
|
+
project=self.project,
|
|
829
|
+
location=self.location,
|
|
830
|
+
retry=retry,
|
|
836
831
|
timeout=timeout,
|
|
837
832
|
)
|
|
838
|
-
self._set_properties(
|
|
833
|
+
self._set_properties(got_job._properties)
|
|
839
834
|
|
|
840
835
|
def cancel(
|
|
841
836
|
self,
|
|
@@ -913,7 +908,7 @@ class _AsyncJob(google.api_core.future.polling.PollingFuture):
|
|
|
913
908
|
def done(
|
|
914
909
|
self,
|
|
915
910
|
retry: "retries.Retry" = DEFAULT_RETRY,
|
|
916
|
-
timeout: Optional[float] =
|
|
911
|
+
timeout: Optional[float] = DEFAULT_GET_JOB_TIMEOUT,
|
|
917
912
|
reload: bool = True,
|
|
918
913
|
) -> bool:
|
|
919
914
|
"""Checks if the job is complete.
|
{google-cloud-bigquery-3.23.0 → google-cloud-bigquery-3.24.0}/google/cloud/bigquery/job/query.py
RENAMED
|
@@ -40,7 +40,11 @@ from google.cloud.bigquery.query import (
|
|
|
40
40
|
StructQueryParameter,
|
|
41
41
|
UDFResource,
|
|
42
42
|
)
|
|
43
|
-
from google.cloud.bigquery.retry import
|
|
43
|
+
from google.cloud.bigquery.retry import (
|
|
44
|
+
DEFAULT_RETRY,
|
|
45
|
+
DEFAULT_JOB_RETRY,
|
|
46
|
+
POLLING_DEFAULT_VALUE,
|
|
47
|
+
)
|
|
44
48
|
from google.cloud.bigquery.routine import RoutineReference
|
|
45
49
|
from google.cloud.bigquery.schema import SchemaField
|
|
46
50
|
from google.cloud.bigquery.table import _EmptyRowIterator
|
|
@@ -1381,7 +1385,10 @@ class QueryJob(_AsyncJob):
|
|
|
1381
1385
|
raise
|
|
1382
1386
|
|
|
1383
1387
|
def _reload_query_results(
|
|
1384
|
-
self,
|
|
1388
|
+
self,
|
|
1389
|
+
retry: "retries.Retry" = DEFAULT_RETRY,
|
|
1390
|
+
timeout: Optional[float] = None,
|
|
1391
|
+
page_size: int = 0,
|
|
1385
1392
|
):
|
|
1386
1393
|
"""Refresh the cached query results unless already cached and complete.
|
|
1387
1394
|
|
|
@@ -1391,6 +1398,9 @@ class QueryJob(_AsyncJob):
|
|
|
1391
1398
|
timeout (Optional[float]):
|
|
1392
1399
|
The number of seconds to wait for the underlying HTTP transport
|
|
1393
1400
|
before using ``retry``.
|
|
1401
|
+
page_size (int):
|
|
1402
|
+
Maximum number of rows in a single response. See maxResults in
|
|
1403
|
+
the jobs.getQueryResults REST API.
|
|
1394
1404
|
"""
|
|
1395
1405
|
# Optimization: avoid a call to jobs.getQueryResults if it's already
|
|
1396
1406
|
# been fetched, e.g. from jobs.query first page of results.
|
|
@@ -1421,7 +1431,14 @@ class QueryJob(_AsyncJob):
|
|
|
1421
1431
|
|
|
1422
1432
|
# If an explicit timeout is not given, fall back to the transport timeout
|
|
1423
1433
|
# stored in _blocking_poll() in the process of polling for job completion.
|
|
1424
|
-
|
|
1434
|
+
if timeout is not None:
|
|
1435
|
+
transport_timeout = timeout
|
|
1436
|
+
else:
|
|
1437
|
+
transport_timeout = self._transport_timeout
|
|
1438
|
+
|
|
1439
|
+
# Handle PollingJob._DEFAULT_VALUE.
|
|
1440
|
+
if not isinstance(transport_timeout, (float, int)):
|
|
1441
|
+
transport_timeout = None
|
|
1425
1442
|
|
|
1426
1443
|
self._query_results = self._client._get_query_results(
|
|
1427
1444
|
self.job_id,
|
|
@@ -1430,6 +1447,7 @@ class QueryJob(_AsyncJob):
|
|
|
1430
1447
|
timeout_ms=timeout_ms,
|
|
1431
1448
|
location=self.location,
|
|
1432
1449
|
timeout=transport_timeout,
|
|
1450
|
+
page_size=page_size,
|
|
1433
1451
|
)
|
|
1434
1452
|
|
|
1435
1453
|
def result( # type: ignore # (incompatible with supertype)
|
|
@@ -1437,7 +1455,7 @@ class QueryJob(_AsyncJob):
|
|
|
1437
1455
|
page_size: Optional[int] = None,
|
|
1438
1456
|
max_results: Optional[int] = None,
|
|
1439
1457
|
retry: Optional[retries.Retry] = DEFAULT_RETRY,
|
|
1440
|
-
timeout: Optional[float] =
|
|
1458
|
+
timeout: Optional[Union[float, object]] = POLLING_DEFAULT_VALUE,
|
|
1441
1459
|
start_index: Optional[int] = None,
|
|
1442
1460
|
job_retry: Optional[retries.Retry] = DEFAULT_JOB_RETRY,
|
|
1443
1461
|
) -> Union["RowIterator", _EmptyRowIterator]:
|
|
@@ -1457,11 +1475,14 @@ class QueryJob(_AsyncJob):
|
|
|
1457
1475
|
is ``DONE``, retrying is aborted early even if the
|
|
1458
1476
|
results are not available, as this will not change
|
|
1459
1477
|
anymore.
|
|
1460
|
-
timeout (Optional[float
|
|
1478
|
+
timeout (Optional[Union[float, \
|
|
1479
|
+
google.api_core.future.polling.PollingFuture._DEFAULT_VALUE, \
|
|
1480
|
+
]]):
|
|
1461
1481
|
The number of seconds to wait for the underlying HTTP transport
|
|
1462
|
-
before using ``retry``.
|
|
1463
|
-
|
|
1464
|
-
|
|
1482
|
+
before using ``retry``. If ``None``, wait indefinitely
|
|
1483
|
+
unless an error is returned. If unset, only the
|
|
1484
|
+
underlying API calls have their default timeouts, but we still
|
|
1485
|
+
wait indefinitely for the job to finish.
|
|
1465
1486
|
start_index (Optional[int]):
|
|
1466
1487
|
The zero-based index of the starting row to read.
|
|
1467
1488
|
job_retry (Optional[google.api_core.retry.Retry]):
|
|
@@ -1507,6 +1528,27 @@ class QueryJob(_AsyncJob):
|
|
|
1507
1528
|
# Intentionally omit job_id and query_id since this doesn't
|
|
1508
1529
|
# actually correspond to a finished query job.
|
|
1509
1530
|
)
|
|
1531
|
+
|
|
1532
|
+
# Setting max_results should be equivalent to setting page_size with
|
|
1533
|
+
# regards to allowing the user to tune how many results to download
|
|
1534
|
+
# while we wait for the query to finish. See internal issue:
|
|
1535
|
+
# 344008814.
|
|
1536
|
+
if page_size is None and max_results is not None:
|
|
1537
|
+
page_size = max_results
|
|
1538
|
+
|
|
1539
|
+
# When timeout has default sentinel value ``object()``, do not pass
|
|
1540
|
+
# anything to invoke default timeouts in subsequent calls.
|
|
1541
|
+
done_kwargs: Dict[str, Union[_helpers.TimeoutType, object]] = {}
|
|
1542
|
+
reload_query_results_kwargs: Dict[str, Union[_helpers.TimeoutType, object]] = {}
|
|
1543
|
+
list_rows_kwargs: Dict[str, Union[_helpers.TimeoutType, object]] = {}
|
|
1544
|
+
if type(timeout) is not object:
|
|
1545
|
+
done_kwargs["timeout"] = timeout
|
|
1546
|
+
list_rows_kwargs["timeout"] = timeout
|
|
1547
|
+
reload_query_results_kwargs["timeout"] = timeout
|
|
1548
|
+
|
|
1549
|
+
if page_size is not None:
|
|
1550
|
+
reload_query_results_kwargs["page_size"] = page_size
|
|
1551
|
+
|
|
1510
1552
|
try:
|
|
1511
1553
|
retry_do_query = getattr(self, "_retry_do_query", None)
|
|
1512
1554
|
if retry_do_query is not None:
|
|
@@ -1543,12 +1585,17 @@ class QueryJob(_AsyncJob):
|
|
|
1543
1585
|
self._retry_do_query = retry_do_query
|
|
1544
1586
|
self._job_retry = job_retry
|
|
1545
1587
|
|
|
1588
|
+
# If the job hasn't been created, create it now. Related:
|
|
1589
|
+
# https://github.com/googleapis/python-bigquery/issues/1940
|
|
1590
|
+
if self.state is None:
|
|
1591
|
+
self._begin(retry=retry, **done_kwargs)
|
|
1592
|
+
|
|
1546
1593
|
# Refresh the job status with jobs.get because some of the
|
|
1547
1594
|
# exceptions thrown by jobs.getQueryResults like timeout and
|
|
1548
1595
|
# rateLimitExceeded errors are ambiguous. We want to know if
|
|
1549
1596
|
# the query job failed and not just the call to
|
|
1550
1597
|
# jobs.getQueryResults.
|
|
1551
|
-
if self.done(retry=retry,
|
|
1598
|
+
if self.done(retry=retry, **done_kwargs):
|
|
1552
1599
|
# If it's already failed, we might as well stop.
|
|
1553
1600
|
job_failed_exception = self.exception()
|
|
1554
1601
|
if job_failed_exception is not None:
|
|
@@ -1585,14 +1632,16 @@ class QueryJob(_AsyncJob):
|
|
|
1585
1632
|
# response from the REST API. This ensures we aren't
|
|
1586
1633
|
# making any extra API calls if the previous loop
|
|
1587
1634
|
# iteration fetched the finished job.
|
|
1588
|
-
self._reload_query_results(
|
|
1635
|
+
self._reload_query_results(
|
|
1636
|
+
retry=retry, **reload_query_results_kwargs
|
|
1637
|
+
)
|
|
1589
1638
|
return True
|
|
1590
1639
|
|
|
1591
1640
|
# Call jobs.getQueryResults with max results set to 0 just to
|
|
1592
1641
|
# wait for the query to finish. Unlike most methods,
|
|
1593
1642
|
# jobs.getQueryResults hangs as long as it can to ensure we
|
|
1594
1643
|
# know when the query has finished as soon as possible.
|
|
1595
|
-
self._reload_query_results(retry=retry,
|
|
1644
|
+
self._reload_query_results(retry=retry, **reload_query_results_kwargs)
|
|
1596
1645
|
|
|
1597
1646
|
# Even if the query is finished now according to
|
|
1598
1647
|
# jobs.getQueryResults, we'll want to reload the job status if
|
|
@@ -1665,8 +1714,9 @@ class QueryJob(_AsyncJob):
|
|
|
1665
1714
|
# We know that there's at least 1 row, so only treat the response from
|
|
1666
1715
|
# jobs.getQueryResults / jobs.query as the first page of the
|
|
1667
1716
|
# RowIterator response if there are any rows in it. This prevents us
|
|
1668
|
-
# from stopping the iteration early
|
|
1669
|
-
# there's no next
|
|
1717
|
+
# from stopping the iteration early in the cases where we set
|
|
1718
|
+
# maxResults=0. In that case, we're missing rows and there's no next
|
|
1719
|
+
# page token.
|
|
1670
1720
|
first_page_response = self._query_results._properties
|
|
1671
1721
|
if "rows" not in first_page_response:
|
|
1672
1722
|
first_page_response = None
|
|
@@ -1682,10 +1732,10 @@ class QueryJob(_AsyncJob):
|
|
|
1682
1732
|
max_results=max_results,
|
|
1683
1733
|
start_index=start_index,
|
|
1684
1734
|
retry=retry,
|
|
1685
|
-
timeout=timeout,
|
|
1686
1735
|
query_id=self.query_id,
|
|
1687
1736
|
first_page_response=first_page_response,
|
|
1688
1737
|
num_dml_affected_rows=self._query_results.num_dml_affected_rows,
|
|
1738
|
+
**list_rows_kwargs,
|
|
1689
1739
|
)
|
|
1690
1740
|
rows._preserve_order = _contains_order_by(self.query)
|
|
1691
1741
|
return rows
|
{google-cloud-bigquery-3.23.0 → google-cloud-bigquery-3.24.0}/google/cloud/bigquery/retry.py
RENAMED
|
@@ -14,6 +14,7 @@
|
|
|
14
14
|
|
|
15
15
|
from google.api_core import exceptions
|
|
16
16
|
from google.api_core import retry
|
|
17
|
+
import google.api_core.future.polling
|
|
17
18
|
from google.auth import exceptions as auth_exceptions # type: ignore
|
|
18
19
|
import requests.exceptions
|
|
19
20
|
|
|
@@ -119,6 +120,14 @@ def _job_should_retry(exc):
|
|
|
119
120
|
if isinstance(exc, exceptions.RetryError):
|
|
120
121
|
exc = exc.cause
|
|
121
122
|
|
|
123
|
+
# Per https://github.com/googleapis/python-bigquery/issues/1929, sometimes
|
|
124
|
+
# retriable errors make their way here. Because of the separate
|
|
125
|
+
# `restart_query_job` logic to make sure we aren't restarting non-failed
|
|
126
|
+
# jobs, it should be safe to continue and not totally fail our attempt at
|
|
127
|
+
# waiting for the query to complete.
|
|
128
|
+
if _should_retry(exc):
|
|
129
|
+
return True
|
|
130
|
+
|
|
122
131
|
if not hasattr(exc, "errors") or len(exc.errors) == 0:
|
|
123
132
|
return False
|
|
124
133
|
|
|
@@ -132,3 +141,13 @@ DEFAULT_JOB_RETRY = retry.Retry(
|
|
|
132
141
|
"""
|
|
133
142
|
The default job retry object.
|
|
134
143
|
"""
|
|
144
|
+
|
|
145
|
+
DEFAULT_GET_JOB_TIMEOUT = 128
|
|
146
|
+
"""
|
|
147
|
+
Default timeout for Client.get_job().
|
|
148
|
+
"""
|
|
149
|
+
|
|
150
|
+
POLLING_DEFAULT_VALUE = google.api_core.future.polling.PollingFuture._DEFAULT_VALUE
|
|
151
|
+
"""
|
|
152
|
+
Default value defined in google.api_core.future.polling.PollingFuture.
|
|
153
|
+
"""
|
{google-cloud-bigquery-3.23.0 → google-cloud-bigquery-3.24.0}/google/cloud/bigquery/table.py
RENAMED
|
@@ -108,7 +108,17 @@ _RANGE_PYARROW_WARNING = (
|
|
|
108
108
|
|
|
109
109
|
# How many of the total rows need to be downloaded already for us to skip
|
|
110
110
|
# calling the BQ Storage API?
|
|
111
|
-
|
|
111
|
+
#
|
|
112
|
+
# In microbenchmarks on 2024-05-21, I (tswast@) measure that at about 2 MB of
|
|
113
|
+
# remaining results, it's faster to use the BQ Storage Read API to download
|
|
114
|
+
# the results than use jobs.getQueryResults. Since we don't have a good way to
|
|
115
|
+
# know the remaining bytes, we estimate by remaining number of rows.
|
|
116
|
+
#
|
|
117
|
+
# Except when rows themselves are larger, I observe that the a single page of
|
|
118
|
+
# results will be around 10 MB. Therefore, the proportion of rows already
|
|
119
|
+
# downloaded should be 10 (first page) / 12 (all results) or less for it to be
|
|
120
|
+
# worth it to make a call to jobs.getQueryResults.
|
|
121
|
+
ALMOST_COMPLETELY_CACHED_RATIO = 0.833333
|
|
112
122
|
|
|
113
123
|
|
|
114
124
|
def _reference_getter(table):
|
|
@@ -1714,6 +1724,10 @@ class RowIterator(HTTPIterator):
|
|
|
1714
1724
|
try:
|
|
1715
1725
|
_versions_helpers.BQ_STORAGE_VERSIONS.try_import(raise_if_error=True)
|
|
1716
1726
|
except bq_exceptions.BigQueryStorageNotFoundError:
|
|
1727
|
+
warnings.warn(
|
|
1728
|
+
"BigQuery Storage module not found, fetch data with the REST "
|
|
1729
|
+
"endpoint instead."
|
|
1730
|
+
)
|
|
1717
1731
|
return False
|
|
1718
1732
|
except bq_exceptions.LegacyBigQueryStorageError as exc:
|
|
1719
1733
|
warnings.warn(str(exc))
|
|
@@ -1745,7 +1759,7 @@ class RowIterator(HTTPIterator):
|
|
|
1745
1759
|
if self._page_size is not None:
|
|
1746
1760
|
if self.page_number and "startIndex" in params:
|
|
1747
1761
|
del params["startIndex"]
|
|
1748
|
-
|
|
1762
|
+
|
|
1749
1763
|
return self.api_request(
|
|
1750
1764
|
method=self._HTTP_METHOD, path=self.path, query_params=params
|
|
1751
1765
|
)
|