google-cloud-bigquery 3.46.0__tar.gz → 3.46.2__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.46.0/google_cloud_bigquery.egg-info → google_cloud_bigquery-3.46.2}/PKG-INFO +1 -1
- google_cloud_bigquery-3.46.2/google/cloud/bigquery/_arrow_query.py +125 -0
- {google_cloud_bigquery-3.46.0 → google_cloud_bigquery-3.46.2}/google/cloud/bigquery/external_config.py +4 -4
- {google_cloud_bigquery-3.46.0 → google_cloud_bigquery-3.46.2}/google/cloud/bigquery/schema.py +65 -17
- {google_cloud_bigquery-3.46.0 → google_cloud_bigquery-3.46.2}/google/cloud/bigquery/table.py +19 -116
- {google_cloud_bigquery-3.46.0 → google_cloud_bigquery-3.46.2}/google/cloud/bigquery/version.py +1 -1
- {google_cloud_bigquery-3.46.0 → google_cloud_bigquery-3.46.2/google_cloud_bigquery.egg-info}/PKG-INFO +1 -1
- {google_cloud_bigquery-3.46.0 → google_cloud_bigquery-3.46.2}/google_cloud_bigquery.egg-info/SOURCES.txt +1 -0
- {google_cloud_bigquery-3.46.0 → google_cloud_bigquery-3.46.2}/tests/unit/job/test_query.py +53 -0
- {google_cloud_bigquery-3.46.0 → google_cloud_bigquery-3.46.2}/tests/unit/test_external_config.py +17 -0
- {google_cloud_bigquery-3.46.0 → google_cloud_bigquery-3.46.2}/tests/unit/test_query_results_format_arrow.py +7 -7
- {google_cloud_bigquery-3.46.0 → google_cloud_bigquery-3.46.2}/tests/unit/test_schema.py +86 -4
- {google_cloud_bigquery-3.46.0 → google_cloud_bigquery-3.46.2}/tests/unit/test_table.py +23 -18
- {google_cloud_bigquery-3.46.0 → google_cloud_bigquery-3.46.2}/LICENSE +0 -0
- {google_cloud_bigquery-3.46.0 → google_cloud_bigquery-3.46.2}/MANIFEST.in +0 -0
- {google_cloud_bigquery-3.46.0 → google_cloud_bigquery-3.46.2}/README.rst +0 -0
- {google_cloud_bigquery-3.46.0 → google_cloud_bigquery-3.46.2}/google/cloud/bigquery/__init__.py +0 -0
- {google_cloud_bigquery-3.46.0 → google_cloud_bigquery-3.46.2}/google/cloud/bigquery/_helpers.py +0 -0
- {google_cloud_bigquery-3.46.0 → google_cloud_bigquery-3.46.2}/google/cloud/bigquery/_http.py +0 -0
- {google_cloud_bigquery-3.46.0 → google_cloud_bigquery-3.46.2}/google/cloud/bigquery/_job_helpers.py +0 -0
- {google_cloud_bigquery-3.46.0 → google_cloud_bigquery-3.46.2}/google/cloud/bigquery/_pandas_helpers.py +0 -0
- {google_cloud_bigquery-3.46.0 → google_cloud_bigquery-3.46.2}/google/cloud/bigquery/_pyarrow_helpers.py +0 -0
- {google_cloud_bigquery-3.46.0 → google_cloud_bigquery-3.46.2}/google/cloud/bigquery/_string_references.py +0 -0
- {google_cloud_bigquery-3.46.0 → google_cloud_bigquery-3.46.2}/google/cloud/bigquery/_tqdm_helpers.py +0 -0
- {google_cloud_bigquery-3.46.0 → google_cloud_bigquery-3.46.2}/google/cloud/bigquery/_versions_helpers.py +0 -0
- {google_cloud_bigquery-3.46.0 → google_cloud_bigquery-3.46.2}/google/cloud/bigquery/client.py +0 -0
- {google_cloud_bigquery-3.46.0 → google_cloud_bigquery-3.46.2}/google/cloud/bigquery/dataset.py +0 -0
- {google_cloud_bigquery-3.46.0 → google_cloud_bigquery-3.46.2}/google/cloud/bigquery/dbapi/__init__.py +0 -0
- {google_cloud_bigquery-3.46.0 → google_cloud_bigquery-3.46.2}/google/cloud/bigquery/dbapi/_helpers.py +0 -0
- {google_cloud_bigquery-3.46.0 → google_cloud_bigquery-3.46.2}/google/cloud/bigquery/dbapi/connection.py +0 -0
- {google_cloud_bigquery-3.46.0 → google_cloud_bigquery-3.46.2}/google/cloud/bigquery/dbapi/cursor.py +0 -0
- {google_cloud_bigquery-3.46.0 → google_cloud_bigquery-3.46.2}/google/cloud/bigquery/dbapi/exceptions.py +0 -0
- {google_cloud_bigquery-3.46.0 → google_cloud_bigquery-3.46.2}/google/cloud/bigquery/dbapi/types.py +0 -0
- {google_cloud_bigquery-3.46.0 → google_cloud_bigquery-3.46.2}/google/cloud/bigquery/encryption_configuration.py +0 -0
- {google_cloud_bigquery-3.46.0 → google_cloud_bigquery-3.46.2}/google/cloud/bigquery/enums.py +0 -0
- {google_cloud_bigquery-3.46.0 → google_cloud_bigquery-3.46.2}/google/cloud/bigquery/exceptions.py +0 -0
- {google_cloud_bigquery-3.46.0 → google_cloud_bigquery-3.46.2}/google/cloud/bigquery/format_options.py +0 -0
- {google_cloud_bigquery-3.46.0 → google_cloud_bigquery-3.46.2}/google/cloud/bigquery/iam.py +0 -0
- {google_cloud_bigquery-3.46.0 → google_cloud_bigquery-3.46.2}/google/cloud/bigquery/job/__init__.py +0 -0
- {google_cloud_bigquery-3.46.0 → google_cloud_bigquery-3.46.2}/google/cloud/bigquery/job/base.py +0 -0
- {google_cloud_bigquery-3.46.0 → google_cloud_bigquery-3.46.2}/google/cloud/bigquery/job/copy_.py +0 -0
- {google_cloud_bigquery-3.46.0 → google_cloud_bigquery-3.46.2}/google/cloud/bigquery/job/extract.py +0 -0
- {google_cloud_bigquery-3.46.0 → google_cloud_bigquery-3.46.2}/google/cloud/bigquery/job/load.py +0 -0
- {google_cloud_bigquery-3.46.0 → google_cloud_bigquery-3.46.2}/google/cloud/bigquery/job/query.py +0 -0
- {google_cloud_bigquery-3.46.0 → google_cloud_bigquery-3.46.2}/google/cloud/bigquery/magics/__init__.py +0 -0
- {google_cloud_bigquery-3.46.0 → google_cloud_bigquery-3.46.2}/google/cloud/bigquery/magics/line_arg_parser/__init__.py +0 -0
- {google_cloud_bigquery-3.46.0 → google_cloud_bigquery-3.46.2}/google/cloud/bigquery/magics/line_arg_parser/exceptions.py +0 -0
- {google_cloud_bigquery-3.46.0 → google_cloud_bigquery-3.46.2}/google/cloud/bigquery/magics/line_arg_parser/lexer.py +0 -0
- {google_cloud_bigquery-3.46.0 → google_cloud_bigquery-3.46.2}/google/cloud/bigquery/magics/line_arg_parser/parser.py +0 -0
- {google_cloud_bigquery-3.46.0 → google_cloud_bigquery-3.46.2}/google/cloud/bigquery/magics/line_arg_parser/visitors.py +0 -0
- {google_cloud_bigquery-3.46.0 → google_cloud_bigquery-3.46.2}/google/cloud/bigquery/magics/magics.py +0 -0
- {google_cloud_bigquery-3.46.0 → google_cloud_bigquery-3.46.2}/google/cloud/bigquery/model.py +0 -0
- {google_cloud_bigquery-3.46.0 → google_cloud_bigquery-3.46.2}/google/cloud/bigquery/opentelemetry_tracing.py +0 -0
- {google_cloud_bigquery-3.46.0 → google_cloud_bigquery-3.46.2}/google/cloud/bigquery/py.typed +0 -0
- {google_cloud_bigquery-3.46.0 → google_cloud_bigquery-3.46.2}/google/cloud/bigquery/query.py +0 -0
- {google_cloud_bigquery-3.46.0 → google_cloud_bigquery-3.46.2}/google/cloud/bigquery/retry.py +0 -0
- {google_cloud_bigquery-3.46.0 → google_cloud_bigquery-3.46.2}/google/cloud/bigquery/routine/__init__.py +0 -0
- {google_cloud_bigquery-3.46.0 → google_cloud_bigquery-3.46.2}/google/cloud/bigquery/routine/routine.py +0 -0
- {google_cloud_bigquery-3.46.0 → google_cloud_bigquery-3.46.2}/google/cloud/bigquery/standard_sql.py +0 -0
- {google_cloud_bigquery-3.46.0 → google_cloud_bigquery-3.46.2}/google/cloud/bigquery_v2/__init__.py +0 -0
- {google_cloud_bigquery-3.46.0 → google_cloud_bigquery-3.46.2}/google/cloud/bigquery_v2/types/__init__.py +0 -0
- {google_cloud_bigquery-3.46.0 → google_cloud_bigquery-3.46.2}/google/cloud/bigquery_v2/types/encryption_config.py +0 -0
- {google_cloud_bigquery-3.46.0 → google_cloud_bigquery-3.46.2}/google/cloud/bigquery_v2/types/model.py +0 -0
- {google_cloud_bigquery-3.46.0 → google_cloud_bigquery-3.46.2}/google/cloud/bigquery_v2/types/model_reference.py +0 -0
- {google_cloud_bigquery-3.46.0 → google_cloud_bigquery-3.46.2}/google/cloud/bigquery_v2/types/standard_sql.py +0 -0
- {google_cloud_bigquery-3.46.0 → google_cloud_bigquery-3.46.2}/google/cloud/bigquery_v2/types/table_reference.py +0 -0
- {google_cloud_bigquery-3.46.0 → google_cloud_bigquery-3.46.2}/google_cloud_bigquery.egg-info/dependency_links.txt +0 -0
- {google_cloud_bigquery-3.46.0 → google_cloud_bigquery-3.46.2}/google_cloud_bigquery.egg-info/requires.txt +0 -0
- {google_cloud_bigquery-3.46.0 → google_cloud_bigquery-3.46.2}/google_cloud_bigquery.egg-info/top_level.txt +0 -0
- {google_cloud_bigquery-3.46.0 → google_cloud_bigquery-3.46.2}/pyproject.toml +0 -0
- {google_cloud_bigquery-3.46.0 → google_cloud_bigquery-3.46.2}/setup.cfg +0 -0
- {google_cloud_bigquery-3.46.0 → google_cloud_bigquery-3.46.2}/setup.py +0 -0
- {google_cloud_bigquery-3.46.0 → google_cloud_bigquery-3.46.2}/tests/__init__.py +0 -0
- {google_cloud_bigquery-3.46.0 → google_cloud_bigquery-3.46.2}/tests/data/characters.json +0 -0
- {google_cloud_bigquery-3.46.0 → google_cloud_bigquery-3.46.2}/tests/data/characters.jsonl +0 -0
- {google_cloud_bigquery-3.46.0 → google_cloud_bigquery-3.46.2}/tests/data/colors.avro +0 -0
- {google_cloud_bigquery-3.46.0 → google_cloud_bigquery-3.46.2}/tests/data/numeric_38_12.parquet +0 -0
- {google_cloud_bigquery-3.46.0 → google_cloud_bigquery-3.46.2}/tests/data/people.csv +0 -0
- {google_cloud_bigquery-3.46.0 → google_cloud_bigquery-3.46.2}/tests/data/pico.csv +0 -0
- {google_cloud_bigquery-3.46.0 → google_cloud_bigquery-3.46.2}/tests/data/pico_schema.json +0 -0
- {google_cloud_bigquery-3.46.0 → google_cloud_bigquery-3.46.2}/tests/data/scalars.csv +0 -0
- {google_cloud_bigquery-3.46.0 → google_cloud_bigquery-3.46.2}/tests/data/scalars.jsonl +0 -0
- {google_cloud_bigquery-3.46.0 → google_cloud_bigquery-3.46.2}/tests/data/scalars_extreme.jsonl +0 -0
- {google_cloud_bigquery-3.46.0 → google_cloud_bigquery-3.46.2}/tests/data/scalars_schema.json +0 -0
- {google_cloud_bigquery-3.46.0 → google_cloud_bigquery-3.46.2}/tests/data/scalars_schema_csv.json +0 -0
- {google_cloud_bigquery-3.46.0 → google_cloud_bigquery-3.46.2}/tests/data/schema.json +0 -0
- {google_cloud_bigquery-3.46.0 → google_cloud_bigquery-3.46.2}/tests/scrub_datasets.py +0 -0
- {google_cloud_bigquery-3.46.0 → google_cloud_bigquery-3.46.2}/tests/system/__init__.py +0 -0
- {google_cloud_bigquery-3.46.0 → google_cloud_bigquery-3.46.2}/tests/system/conftest.py +0 -0
- {google_cloud_bigquery-3.46.0 → google_cloud_bigquery-3.46.2}/tests/system/helpers.py +0 -0
- {google_cloud_bigquery-3.46.0 → google_cloud_bigquery-3.46.2}/tests/system/test_arrow.py +0 -0
- {google_cloud_bigquery-3.46.0 → google_cloud_bigquery-3.46.2}/tests/system/test_client.py +0 -0
- {google_cloud_bigquery-3.46.0 → google_cloud_bigquery-3.46.2}/tests/system/test_job_retry.py +0 -0
- {google_cloud_bigquery-3.46.0 → google_cloud_bigquery-3.46.2}/tests/system/test_list_rows.py +0 -0
- {google_cloud_bigquery-3.46.0 → google_cloud_bigquery-3.46.2}/tests/system/test_magics.py +0 -0
- {google_cloud_bigquery-3.46.0 → google_cloud_bigquery-3.46.2}/tests/system/test_pandas.py +0 -0
- {google_cloud_bigquery-3.46.0 → google_cloud_bigquery-3.46.2}/tests/system/test_query.py +0 -0
- {google_cloud_bigquery-3.46.0 → google_cloud_bigquery-3.46.2}/tests/system/test_ssl_retry.py +0 -0
- {google_cloud_bigquery-3.46.0 → google_cloud_bigquery-3.46.2}/tests/system/test_structs.py +0 -0
- {google_cloud_bigquery-3.46.0 → google_cloud_bigquery-3.46.2}/tests/unit/__init__.py +0 -0
- {google_cloud_bigquery-3.46.0 → google_cloud_bigquery-3.46.2}/tests/unit/_helpers/__init__.py +0 -0
- {google_cloud_bigquery-3.46.0 → google_cloud_bigquery-3.46.2}/tests/unit/_helpers/test_cell_data_parser.py +0 -0
- {google_cloud_bigquery-3.46.0 → google_cloud_bigquery-3.46.2}/tests/unit/_helpers/test_data_frame_cell_data_parser.py +0 -0
- {google_cloud_bigquery-3.46.0 → google_cloud_bigquery-3.46.2}/tests/unit/_helpers/test_scalar_query_param_parser.py +0 -0
- {google_cloud_bigquery-3.46.0 → google_cloud_bigquery-3.46.2}/tests/unit/conftest.py +0 -0
- {google_cloud_bigquery-3.46.0 → google_cloud_bigquery-3.46.2}/tests/unit/helpers.py +0 -0
- {google_cloud_bigquery-3.46.0 → google_cloud_bigquery-3.46.2}/tests/unit/job/__init__.py +0 -0
- {google_cloud_bigquery-3.46.0 → google_cloud_bigquery-3.46.2}/tests/unit/job/helpers.py +0 -0
- {google_cloud_bigquery-3.46.0 → google_cloud_bigquery-3.46.2}/tests/unit/job/test_async_job_retry.py +0 -0
- {google_cloud_bigquery-3.46.0 → google_cloud_bigquery-3.46.2}/tests/unit/job/test_base.py +0 -0
- {google_cloud_bigquery-3.46.0 → google_cloud_bigquery-3.46.2}/tests/unit/job/test_copy.py +0 -0
- {google_cloud_bigquery-3.46.0 → google_cloud_bigquery-3.46.2}/tests/unit/job/test_extract.py +0 -0
- {google_cloud_bigquery-3.46.0 → google_cloud_bigquery-3.46.2}/tests/unit/job/test_load.py +0 -0
- {google_cloud_bigquery-3.46.0 → google_cloud_bigquery-3.46.2}/tests/unit/job/test_load_config.py +0 -0
- {google_cloud_bigquery-3.46.0 → google_cloud_bigquery-3.46.2}/tests/unit/job/test_query_config.py +0 -0
- {google_cloud_bigquery-3.46.0 → google_cloud_bigquery-3.46.2}/tests/unit/job/test_query_job_retry.py +0 -0
- {google_cloud_bigquery-3.46.0 → google_cloud_bigquery-3.46.2}/tests/unit/job/test_query_pandas.py +0 -0
- {google_cloud_bigquery-3.46.0 → google_cloud_bigquery-3.46.2}/tests/unit/job/test_query_stats.py +0 -0
- {google_cloud_bigquery-3.46.0 → google_cloud_bigquery-3.46.2}/tests/unit/line_arg_parser/__init__.py +0 -0
- {google_cloud_bigquery-3.46.0 → google_cloud_bigquery-3.46.2}/tests/unit/line_arg_parser/test_lexer.py +0 -0
- {google_cloud_bigquery-3.46.0 → google_cloud_bigquery-3.46.2}/tests/unit/line_arg_parser/test_parser.py +0 -0
- {google_cloud_bigquery-3.46.0 → google_cloud_bigquery-3.46.2}/tests/unit/line_arg_parser/test_visitors.py +0 -0
- {google_cloud_bigquery-3.46.0 → google_cloud_bigquery-3.46.2}/tests/unit/model/__init__.py +0 -0
- {google_cloud_bigquery-3.46.0 → google_cloud_bigquery-3.46.2}/tests/unit/model/test_model.py +0 -0
- {google_cloud_bigquery-3.46.0 → google_cloud_bigquery-3.46.2}/tests/unit/model/test_model_reference.py +0 -0
- {google_cloud_bigquery-3.46.0 → google_cloud_bigquery-3.46.2}/tests/unit/routine/__init__.py +0 -0
- {google_cloud_bigquery-3.46.0 → google_cloud_bigquery-3.46.2}/tests/unit/routine/test_external_runtime_options.py +0 -0
- {google_cloud_bigquery-3.46.0 → google_cloud_bigquery-3.46.2}/tests/unit/routine/test_remote_function_options.py +0 -0
- {google_cloud_bigquery-3.46.0 → google_cloud_bigquery-3.46.2}/tests/unit/routine/test_routine.py +0 -0
- {google_cloud_bigquery-3.46.0 → google_cloud_bigquery-3.46.2}/tests/unit/routine/test_routine_argument.py +0 -0
- {google_cloud_bigquery-3.46.0 → google_cloud_bigquery-3.46.2}/tests/unit/routine/test_routine_reference.py +0 -0
- {google_cloud_bigquery-3.46.0 → google_cloud_bigquery-3.46.2}/tests/unit/test__helpers.py +0 -0
- {google_cloud_bigquery-3.46.0 → google_cloud_bigquery-3.46.2}/tests/unit/test__http.py +0 -0
- {google_cloud_bigquery-3.46.0 → google_cloud_bigquery-3.46.2}/tests/unit/test__job_helpers.py +0 -0
- {google_cloud_bigquery-3.46.0 → google_cloud_bigquery-3.46.2}/tests/unit/test__job_helpers_retry.py +0 -0
- {google_cloud_bigquery-3.46.0 → google_cloud_bigquery-3.46.2}/tests/unit/test__pandas_helpers.py +0 -0
- {google_cloud_bigquery-3.46.0 → google_cloud_bigquery-3.46.2}/tests/unit/test__pyarrow_helpers.py +0 -0
- {google_cloud_bigquery-3.46.0 → google_cloud_bigquery-3.46.2}/tests/unit/test__versions_helpers.py +0 -0
- {google_cloud_bigquery-3.46.0 → google_cloud_bigquery-3.46.2}/tests/unit/test_client.py +0 -0
- {google_cloud_bigquery-3.46.0 → google_cloud_bigquery-3.46.2}/tests/unit/test_client_bigframes.py +0 -0
- {google_cloud_bigquery-3.46.0 → google_cloud_bigquery-3.46.2}/tests/unit/test_client_resumable_media_upload.py +0 -0
- {google_cloud_bigquery-3.46.0 → google_cloud_bigquery-3.46.2}/tests/unit/test_client_retry.py +0 -0
- {google_cloud_bigquery-3.46.0 → google_cloud_bigquery-3.46.2}/tests/unit/test_create_dataset.py +0 -0
- {google_cloud_bigquery-3.46.0 → google_cloud_bigquery-3.46.2}/tests/unit/test_dataset.py +0 -0
- {google_cloud_bigquery-3.46.0 → google_cloud_bigquery-3.46.2}/tests/unit/test_dbapi__helpers.py +0 -0
- {google_cloud_bigquery-3.46.0 → google_cloud_bigquery-3.46.2}/tests/unit/test_dbapi_connection.py +0 -0
- {google_cloud_bigquery-3.46.0 → google_cloud_bigquery-3.46.2}/tests/unit/test_dbapi_cursor.py +0 -0
- {google_cloud_bigquery-3.46.0 → google_cloud_bigquery-3.46.2}/tests/unit/test_dbapi_types.py +0 -0
- {google_cloud_bigquery-3.46.0 → google_cloud_bigquery-3.46.2}/tests/unit/test_delete_dataset.py +0 -0
- {google_cloud_bigquery-3.46.0 → google_cloud_bigquery-3.46.2}/tests/unit/test_docs.py +0 -0
- {google_cloud_bigquery-3.46.0 → google_cloud_bigquery-3.46.2}/tests/unit/test_encryption_configuration.py +0 -0
- {google_cloud_bigquery-3.46.0 → google_cloud_bigquery-3.46.2}/tests/unit/test_format_options.py +0 -0
- {google_cloud_bigquery-3.46.0 → google_cloud_bigquery-3.46.2}/tests/unit/test_job_retry.py +0 -0
- {google_cloud_bigquery-3.46.0 → google_cloud_bigquery-3.46.2}/tests/unit/test_legacy_types.py +0 -0
- {google_cloud_bigquery-3.46.0 → google_cloud_bigquery-3.46.2}/tests/unit/test_list_datasets.py +0 -0
- {google_cloud_bigquery-3.46.0 → google_cloud_bigquery-3.46.2}/tests/unit/test_list_jobs.py +0 -0
- {google_cloud_bigquery-3.46.0 → google_cloud_bigquery-3.46.2}/tests/unit/test_list_models.py +0 -0
- {google_cloud_bigquery-3.46.0 → google_cloud_bigquery-3.46.2}/tests/unit/test_list_projects.py +0 -0
- {google_cloud_bigquery-3.46.0 → google_cloud_bigquery-3.46.2}/tests/unit/test_list_routines.py +0 -0
- {google_cloud_bigquery-3.46.0 → google_cloud_bigquery-3.46.2}/tests/unit/test_list_tables.py +0 -0
- {google_cloud_bigquery-3.46.0 → google_cloud_bigquery-3.46.2}/tests/unit/test_magics.py +0 -0
- {google_cloud_bigquery-3.46.0 → google_cloud_bigquery-3.46.2}/tests/unit/test_opentelemetry_tracing.py +0 -0
- {google_cloud_bigquery-3.46.0 → google_cloud_bigquery-3.46.2}/tests/unit/test_packaging.py +0 -0
- {google_cloud_bigquery-3.46.0 → google_cloud_bigquery-3.46.2}/tests/unit/test_query.py +0 -0
- {google_cloud_bigquery-3.46.0 → google_cloud_bigquery-3.46.2}/tests/unit/test_retry.py +0 -0
- {google_cloud_bigquery-3.46.0 → google_cloud_bigquery-3.46.2}/tests/unit/test_signature_compatibility.py +0 -0
- {google_cloud_bigquery-3.46.0 → google_cloud_bigquery-3.46.2}/tests/unit/test_standard_sql_types.py +0 -0
- {google_cloud_bigquery-3.46.0 → google_cloud_bigquery-3.46.2}/tests/unit/test_string_references.py +0 -0
- {google_cloud_bigquery-3.46.0 → google_cloud_bigquery-3.46.2}/tests/unit/test_table_arrow.py +0 -0
- {google_cloud_bigquery-3.46.0 → google_cloud_bigquery-3.46.2}/tests/unit/test_table_pandas.py +0 -0
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
# Copyright 2026 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
|
+
"""Read query results returned in Apache Arrow format."""
|
|
16
|
+
|
|
17
|
+
from __future__ import annotations
|
|
18
|
+
|
|
19
|
+
import base64
|
|
20
|
+
from typing import Iterator, Optional, TYPE_CHECKING
|
|
21
|
+
|
|
22
|
+
try:
|
|
23
|
+
import pyarrow # type: ignore
|
|
24
|
+
except ImportError:
|
|
25
|
+
pyarrow = None # type: ignore[assignment]
|
|
26
|
+
|
|
27
|
+
if TYPE_CHECKING: # pragma: NO COVER
|
|
28
|
+
from google.cloud import bigquery_storage
|
|
29
|
+
from google.cloud.bigquery.table import RowIterator
|
|
30
|
+
|
|
31
|
+
_NO_PYARROW_ERROR = (
|
|
32
|
+
"The pyarrow library is not installed, please install "
|
|
33
|
+
"pyarrow to use the to_arrow() function."
|
|
34
|
+
)
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
def download_arrow_from_job(
|
|
38
|
+
row_iterator: "RowIterator",
|
|
39
|
+
bqstorage_client: Optional["bigquery_storage.BigQueryReadClient"] = None,
|
|
40
|
+
timeout: Optional[float] = None,
|
|
41
|
+
) -> Iterator["pyarrow.RecordBatch"]:
|
|
42
|
+
"""Yield Arrow record batches for ``row_iterator``'s ARROW query results.
|
|
43
|
+
|
|
44
|
+
See :meth:`google.cloud.bigquery.table.RowIterator._download_arrow_from_job_id`.
|
|
45
|
+
"""
|
|
46
|
+
if pyarrow is None:
|
|
47
|
+
raise ValueError(_NO_PYARROW_ERROR)
|
|
48
|
+
|
|
49
|
+
# Step 1: Ensure BigQuery Read API client is available upfront.
|
|
50
|
+
if bqstorage_client is None:
|
|
51
|
+
if row_iterator.client is None:
|
|
52
|
+
raise ValueError("RowIterator client is None.")
|
|
53
|
+
bqstorage_client = row_iterator.client._ensure_bqstorage_client()
|
|
54
|
+
if bqstorage_client is None:
|
|
55
|
+
raise ValueError(
|
|
56
|
+
"The google-cloud-bigquery-storage library is required to read Arrow results."
|
|
57
|
+
)
|
|
58
|
+
|
|
59
|
+
offset = 0
|
|
60
|
+
pa_schema = None
|
|
61
|
+
total_rows = row_iterator.total_rows
|
|
62
|
+
job_complete = False
|
|
63
|
+
|
|
64
|
+
# Step 2: Process initial inline Arrow response from jobs.query if available.
|
|
65
|
+
if row_iterator._first_page_response:
|
|
66
|
+
first_page = row_iterator._first_page_response
|
|
67
|
+
row_iterator._first_page_response = None
|
|
68
|
+
|
|
69
|
+
job_complete = bool(first_page.get("jobComplete", False))
|
|
70
|
+
if job_complete:
|
|
71
|
+
total_rows = int(first_page.get("totalRows", 0))
|
|
72
|
+
|
|
73
|
+
arrow_schema_json = first_page.get("arrowSchema")
|
|
74
|
+
if isinstance(arrow_schema_json, dict):
|
|
75
|
+
schema_bytes = arrow_schema_json.get("serializedSchema")
|
|
76
|
+
if schema_bytes:
|
|
77
|
+
if isinstance(schema_bytes, str):
|
|
78
|
+
schema_bytes = base64.b64decode(schema_bytes)
|
|
79
|
+
pa_schema = pyarrow.ipc.read_schema(pyarrow.py_buffer(schema_bytes))
|
|
80
|
+
|
|
81
|
+
arrow_batch_json = first_page.get("arrowRecordBatch")
|
|
82
|
+
if isinstance(arrow_batch_json, dict) and pa_schema is not None:
|
|
83
|
+
batch_bytes = arrow_batch_json.get("serializedRecordBatch")
|
|
84
|
+
if batch_bytes:
|
|
85
|
+
if isinstance(batch_bytes, str):
|
|
86
|
+
batch_bytes = base64.b64decode(batch_bytes)
|
|
87
|
+
batch = pyarrow.ipc.read_record_batch(
|
|
88
|
+
pyarrow.py_buffer(batch_bytes),
|
|
89
|
+
pa_schema,
|
|
90
|
+
)
|
|
91
|
+
offset += batch.num_rows
|
|
92
|
+
yield batch
|
|
93
|
+
|
|
94
|
+
# Step 3: Return early if all results were delivered in the first page response.
|
|
95
|
+
if job_complete and offset >= total_rows:
|
|
96
|
+
return
|
|
97
|
+
|
|
98
|
+
# Step 4: Stream remaining Arrow record batches from the job default stream.
|
|
99
|
+
project = row_iterator._project or (
|
|
100
|
+
row_iterator.client.project if row_iterator.client else None
|
|
101
|
+
)
|
|
102
|
+
location = row_iterator._location or (
|
|
103
|
+
row_iterator.client.location if row_iterator.client else None
|
|
104
|
+
)
|
|
105
|
+
stream_name = f"projects/{project}/locations/{location}/jobs/{row_iterator._job_id}/streams/_default"
|
|
106
|
+
reader = bqstorage_client.read_rows(stream_name, offset=offset, timeout=timeout)
|
|
107
|
+
for response in reader:
|
|
108
|
+
if (
|
|
109
|
+
response.arrow_schema
|
|
110
|
+
and response.arrow_schema.serialized_schema
|
|
111
|
+
and pa_schema is None
|
|
112
|
+
):
|
|
113
|
+
pa_schema = pyarrow.ipc.read_schema(
|
|
114
|
+
pyarrow.py_buffer(response.arrow_schema.serialized_schema)
|
|
115
|
+
)
|
|
116
|
+
if (
|
|
117
|
+
response.arrow_record_batch
|
|
118
|
+
and response.arrow_record_batch.serialized_record_batch
|
|
119
|
+
and pa_schema is not None
|
|
120
|
+
):
|
|
121
|
+
batch = pyarrow.ipc.read_record_batch(
|
|
122
|
+
pyarrow.py_buffer(response.arrow_record_batch.serialized_record_batch),
|
|
123
|
+
pa_schema,
|
|
124
|
+
)
|
|
125
|
+
yield batch
|
|
@@ -729,14 +729,14 @@ class ExternalConfig(object):
|
|
|
729
729
|
self._properties = {"sourceFormat": source_format}
|
|
730
730
|
|
|
731
731
|
@property
|
|
732
|
-
def source_format(self):
|
|
733
|
-
""":class:`~.external_config.ExternalSourceFormat
|
|
732
|
+
def source_format(self) -> Optional[str]:
|
|
733
|
+
"""Optional[:class:`~.external_config.ExternalSourceFormat`]:
|
|
734
734
|
Format of external source.
|
|
735
735
|
|
|
736
736
|
See
|
|
737
737
|
https://cloud.google.com/bigquery/docs/reference/rest/v2/tables#ExternalDataConfiguration.FIELDS.source_format
|
|
738
738
|
"""
|
|
739
|
-
return self._properties
|
|
739
|
+
return self._properties.get("sourceFormat")
|
|
740
740
|
|
|
741
741
|
@property
|
|
742
742
|
def options(self) -> Optional[OptionsType]:
|
|
@@ -1120,7 +1120,7 @@ class ExternalConfig(object):
|
|
|
1120
1120
|
Returns:
|
|
1121
1121
|
ExternalConfig: Configuration parsed from ``resource``.
|
|
1122
1122
|
"""
|
|
1123
|
-
config = cls(resource
|
|
1123
|
+
config = cls(resource.get("sourceFormat"))
|
|
1124
1124
|
config._properties = copy.deepcopy(resource)
|
|
1125
1125
|
return config
|
|
1126
1126
|
|
{google_cloud_bigquery-3.46.0 → google_cloud_bigquery-3.46.2}/google/cloud/bigquery/schema.py
RENAMED
|
@@ -15,16 +15,14 @@
|
|
|
15
15
|
"""Schemas for BigQuery tables / queries."""
|
|
16
16
|
|
|
17
17
|
from __future__ import annotations
|
|
18
|
+
|
|
18
19
|
import enum
|
|
19
20
|
import typing
|
|
20
|
-
from typing import Any,
|
|
21
|
+
from typing import Any, Dict, Iterable, Optional, Sequence, Union, cast
|
|
21
22
|
|
|
22
|
-
from google.cloud.bigquery import _helpers
|
|
23
|
-
from google.cloud.bigquery import standard_sql
|
|
24
|
-
from google.cloud.bigquery import enums
|
|
23
|
+
from google.cloud.bigquery import _helpers, enums, standard_sql
|
|
25
24
|
from google.cloud.bigquery.enums import StandardSqlTypeNames
|
|
26
25
|
|
|
27
|
-
|
|
28
26
|
_STRUCT_TYPES = ("RECORD", "STRUCT")
|
|
29
27
|
|
|
30
28
|
# SQL types reference:
|
|
@@ -109,6 +107,43 @@ class FieldElementType(object):
|
|
|
109
107
|
"""
|
|
110
108
|
return self._properties
|
|
111
109
|
|
|
110
|
+
def _key(self):
|
|
111
|
+
"""A tuple key that uniquely describes this FieldElementType.
|
|
112
|
+
|
|
113
|
+
Used to compute this instance's hashcode and evaluate equality.
|
|
114
|
+
|
|
115
|
+
Returns:
|
|
116
|
+
Tuple: The contents of this :class:`~google.cloud.bigquery.schema.FieldElementType`.
|
|
117
|
+
"""
|
|
118
|
+
return (self.element_type,)
|
|
119
|
+
|
|
120
|
+
def __eq__(self, other):
|
|
121
|
+
if not isinstance(other, FieldElementType):
|
|
122
|
+
return NotImplemented
|
|
123
|
+
return self._key() == other._key()
|
|
124
|
+
|
|
125
|
+
def __ne__(self, other):
|
|
126
|
+
return not self == other
|
|
127
|
+
|
|
128
|
+
def __hash__(self):
|
|
129
|
+
return hash(self._key())
|
|
130
|
+
|
|
131
|
+
def __repr__(self):
|
|
132
|
+
return f"{self.__class__.__name__}(element_type={self.element_type!r})"
|
|
133
|
+
|
|
134
|
+
|
|
135
|
+
class _SchemaFieldKey(typing.NamedTuple):
|
|
136
|
+
name: str
|
|
137
|
+
field_type: str
|
|
138
|
+
mode: str
|
|
139
|
+
default_value_expression: Optional[str]
|
|
140
|
+
description: Optional[str]
|
|
141
|
+
fields: tuple
|
|
142
|
+
policy_tags: Optional[tuple[str, ...]]
|
|
143
|
+
timestamp_precision: Optional[int]
|
|
144
|
+
rounding_mode: Optional[str]
|
|
145
|
+
foreign_type_definition: Optional[str]
|
|
146
|
+
|
|
112
147
|
|
|
113
148
|
class SchemaField(object):
|
|
114
149
|
"""Describe a single field within a table schema.
|
|
@@ -436,6 +471,9 @@ class SchemaField(object):
|
|
|
436
471
|
field_type = f"{field_type}({self.precision}, {self.scale})"
|
|
437
472
|
else:
|
|
438
473
|
field_type = f"{field_type}({self.precision})"
|
|
474
|
+
elif field_type == "RANGE":
|
|
475
|
+
if self.range_element_type is not None:
|
|
476
|
+
field_type = f"{field_type}<{self.range_element_type.element_type}>"
|
|
439
477
|
|
|
440
478
|
policy_tags = (
|
|
441
479
|
None if self.policy_tags is None else tuple(sorted(self.policy_tags.names))
|
|
@@ -443,16 +481,24 @@ class SchemaField(object):
|
|
|
443
481
|
|
|
444
482
|
timestamp_precision = self._properties.get("timestampPrecision")
|
|
445
483
|
|
|
446
|
-
|
|
447
|
-
self.
|
|
448
|
-
|
|
484
|
+
rounding_mode = (
|
|
485
|
+
self.rounding_mode.value
|
|
486
|
+
if isinstance(self.rounding_mode, enums.RoundingMode)
|
|
487
|
+
else self.rounding_mode
|
|
488
|
+
)
|
|
489
|
+
|
|
490
|
+
return _SchemaFieldKey(
|
|
491
|
+
name=self.name,
|
|
492
|
+
field_type=field_type,
|
|
449
493
|
# Mode is always str, if not given it defaults to a str value
|
|
450
|
-
self.mode.upper(), # pytype: disable=attribute-error
|
|
451
|
-
self.default_value_expression,
|
|
452
|
-
self.description,
|
|
453
|
-
self.fields,
|
|
454
|
-
policy_tags,
|
|
455
|
-
timestamp_precision,
|
|
494
|
+
mode=self.mode.upper(), # pytype: disable=attribute-error
|
|
495
|
+
default_value_expression=self.default_value_expression,
|
|
496
|
+
description=self.description,
|
|
497
|
+
fields=self.fields,
|
|
498
|
+
policy_tags=policy_tags,
|
|
499
|
+
timestamp_precision=timestamp_precision,
|
|
500
|
+
rounding_mode=rounding_mode,
|
|
501
|
+
foreign_type_definition=self.foreign_type_definition,
|
|
456
502
|
)
|
|
457
503
|
|
|
458
504
|
def to_standard_sql(self) -> standard_sql.StandardSqlField:
|
|
@@ -503,9 +549,11 @@ class SchemaField(object):
|
|
|
503
549
|
return hash(self._key())
|
|
504
550
|
|
|
505
551
|
def __repr__(self):
|
|
506
|
-
|
|
507
|
-
policy_tags_inst =
|
|
508
|
-
|
|
552
|
+
key = self._key()
|
|
553
|
+
policy_tags_inst = (
|
|
554
|
+
None if key.policy_tags is None else PolicyTagList(key.policy_tags)
|
|
555
|
+
)
|
|
556
|
+
adjusted_key = tuple(key._replace(policy_tags=policy_tags_inst))
|
|
509
557
|
return f"{self.__class__.__name__}{adjusted_key}"
|
|
510
558
|
|
|
511
559
|
|
{google_cloud_bigquery-3.46.0 → google_cloud_bigquery-3.46.2}/google/cloud/bigquery/table.py
RENAMED
|
@@ -16,7 +16,6 @@
|
|
|
16
16
|
|
|
17
17
|
from __future__ import absolute_import
|
|
18
18
|
|
|
19
|
-
import base64
|
|
20
19
|
import copy
|
|
21
20
|
import datetime
|
|
22
21
|
import functools
|
|
@@ -59,6 +58,7 @@ import google.api_core.exceptions
|
|
|
59
58
|
import google.cloud._helpers # type: ignore
|
|
60
59
|
from google.api_core.page_iterator import HTTPIterator
|
|
61
60
|
from google.cloud.bigquery import (
|
|
61
|
+
_arrow_query,
|
|
62
62
|
_helpers,
|
|
63
63
|
_pandas_helpers,
|
|
64
64
|
_string_references,
|
|
@@ -118,12 +118,6 @@ _TO_DATAFRAME_DEPRECATED = (
|
|
|
118
118
|
"For direct, optimized access, please call 'pandas_gbq.read_gbq()' directly."
|
|
119
119
|
)
|
|
120
120
|
|
|
121
|
-
_TO_ARROW_DEPRECATED = (
|
|
122
|
-
"Retrieving PyArrow Tables via google-cloud-bigquery is deprecated. "
|
|
123
|
-
"For direct, optimized access, please call 'pandas_gbq.arrow.read_bigquery_table()' "
|
|
124
|
-
"or 'pandas_gbq.arrow.read_bigquery_query()' directly."
|
|
125
|
-
)
|
|
126
|
-
|
|
127
121
|
_CANNOT_ITERATE_ARROW_ERROR = (
|
|
128
122
|
"Cannot iterate over non-arrow results when queryResultsFormat is ARROW. "
|
|
129
123
|
"Use to_arrow_iterable() or to_arrow() instead."
|
|
@@ -2158,15 +2152,16 @@ class RowIterator(HTTPIterator):
|
|
|
2158
2152
|
|
|
2159
2153
|
params = self._get_query_params()
|
|
2160
2154
|
|
|
2161
|
-
# If the user has provided
|
|
2162
|
-
#
|
|
2163
|
-
#
|
|
2164
|
-
#
|
|
2165
|
-
#
|
|
2155
|
+
# If the user has provided start_index, we need to pass it for the
|
|
2156
|
+
# first page, but once the server hands back a page token we should
|
|
2157
|
+
# not pass start_index, because the server only allows one of them.
|
|
2158
|
+
# This applies whether the pages come from page_size or from the
|
|
2159
|
+
# server splitting a large result. We make a shallow copy of params
|
|
2160
|
+
# and do not alter the original, so if the user iterates the results
|
|
2161
|
+
# again, start_index is preserved.
|
|
2166
2162
|
params_copy = copy.copy(params)
|
|
2167
|
-
if self.
|
|
2168
|
-
|
|
2169
|
-
del params_copy["startIndex"]
|
|
2163
|
+
if self.next_page_token is not None and "startIndex" in params:
|
|
2164
|
+
del params_copy["startIndex"]
|
|
2170
2165
|
|
|
2171
2166
|
return self.api_request(
|
|
2172
2167
|
method=self._HTTP_METHOD, path=self.path, query_params=params_copy
|
|
@@ -2324,84 +2319,9 @@ class RowIterator(HTTPIterator):
|
|
|
2324
2319
|
Yields:
|
|
2325
2320
|
pyarrow.RecordBatch: Record batches generated from the query result.
|
|
2326
2321
|
"""
|
|
2327
|
-
|
|
2328
|
-
|
|
2329
|
-
|
|
2330
|
-
# Step 1: Ensure BigQuery Read API client is available upfront.
|
|
2331
|
-
if bqstorage_client is None:
|
|
2332
|
-
if self.client is None:
|
|
2333
|
-
raise ValueError("RowIterator client is None.")
|
|
2334
|
-
bqstorage_client = self.client._ensure_bqstorage_client()
|
|
2335
|
-
if bqstorage_client is None:
|
|
2336
|
-
raise ValueError(
|
|
2337
|
-
"The google-cloud-bigquery-storage library is required to read Arrow results."
|
|
2338
|
-
)
|
|
2339
|
-
|
|
2340
|
-
offset = 0
|
|
2341
|
-
pa_schema = None
|
|
2342
|
-
total_rows = self.total_rows
|
|
2343
|
-
job_complete = False
|
|
2344
|
-
|
|
2345
|
-
# Step 2: Process initial inline Arrow response from jobs.query if available.
|
|
2346
|
-
if self._first_page_response:
|
|
2347
|
-
first_page = self._first_page_response
|
|
2348
|
-
self._first_page_response = None
|
|
2349
|
-
|
|
2350
|
-
job_complete = bool(first_page.get("jobComplete", False))
|
|
2351
|
-
if job_complete:
|
|
2352
|
-
total_rows = int(first_page.get("totalRows", 0))
|
|
2353
|
-
|
|
2354
|
-
arrow_schema_json = first_page.get("arrowSchema")
|
|
2355
|
-
if isinstance(arrow_schema_json, dict):
|
|
2356
|
-
schema_bytes = arrow_schema_json.get("serializedSchema")
|
|
2357
|
-
if schema_bytes:
|
|
2358
|
-
if isinstance(schema_bytes, str):
|
|
2359
|
-
schema_bytes = base64.b64decode(schema_bytes)
|
|
2360
|
-
pa_schema = pyarrow.ipc.read_schema(pyarrow.py_buffer(schema_bytes))
|
|
2361
|
-
|
|
2362
|
-
arrow_batch_json = first_page.get("arrowRecordBatch")
|
|
2363
|
-
if isinstance(arrow_batch_json, dict) and pa_schema is not None:
|
|
2364
|
-
batch_bytes = arrow_batch_json.get("serializedRecordBatch")
|
|
2365
|
-
if batch_bytes:
|
|
2366
|
-
if isinstance(batch_bytes, str):
|
|
2367
|
-
batch_bytes = base64.b64decode(batch_bytes)
|
|
2368
|
-
batch = pyarrow.ipc.read_record_batch(
|
|
2369
|
-
pyarrow.py_buffer(batch_bytes),
|
|
2370
|
-
pa_schema,
|
|
2371
|
-
)
|
|
2372
|
-
offset += batch.num_rows
|
|
2373
|
-
yield batch
|
|
2374
|
-
|
|
2375
|
-
# Step 3: Return early if all results were delivered in the first page response.
|
|
2376
|
-
if job_complete and offset >= total_rows:
|
|
2377
|
-
return
|
|
2378
|
-
|
|
2379
|
-
# Step 4: Stream remaining Arrow record batches from the job default stream.
|
|
2380
|
-
project = self._project or (self.client.project if self.client else None)
|
|
2381
|
-
location = self._location or (self.client.location if self.client else None)
|
|
2382
|
-
stream_name = f"projects/{project}/locations/{location}/jobs/{self._job_id}/streams/_default"
|
|
2383
|
-
reader = bqstorage_client.read_rows(stream_name, offset=offset, timeout=timeout)
|
|
2384
|
-
for response in reader:
|
|
2385
|
-
if (
|
|
2386
|
-
response.arrow_schema
|
|
2387
|
-
and response.arrow_schema.serialized_schema
|
|
2388
|
-
and pa_schema is None
|
|
2389
|
-
):
|
|
2390
|
-
pa_schema = pyarrow.ipc.read_schema(
|
|
2391
|
-
pyarrow.py_buffer(response.arrow_schema.serialized_schema)
|
|
2392
|
-
)
|
|
2393
|
-
if (
|
|
2394
|
-
response.arrow_record_batch
|
|
2395
|
-
and response.arrow_record_batch.serialized_record_batch
|
|
2396
|
-
and pa_schema is not None
|
|
2397
|
-
):
|
|
2398
|
-
batch = pyarrow.ipc.read_record_batch(
|
|
2399
|
-
pyarrow.py_buffer(
|
|
2400
|
-
response.arrow_record_batch.serialized_record_batch
|
|
2401
|
-
),
|
|
2402
|
-
pa_schema,
|
|
2403
|
-
)
|
|
2404
|
-
yield batch
|
|
2322
|
+
return _arrow_query.download_arrow_from_job(
|
|
2323
|
+
self, bqstorage_client=bqstorage_client, timeout=timeout
|
|
2324
|
+
)
|
|
2405
2325
|
|
|
2406
2326
|
# If changing the signature of this method, make sure to apply the same
|
|
2407
2327
|
# changes to job.QueryJob.to_arrow()
|
|
@@ -2468,12 +2388,6 @@ class RowIterator(HTTPIterator):
|
|
|
2468
2388
|
|
|
2469
2389
|
.. versionadded:: 1.17.0
|
|
2470
2390
|
"""
|
|
2471
|
-
warnings.warn(
|
|
2472
|
-
_TO_ARROW_DEPRECATED,
|
|
2473
|
-
PendingDeprecationWarning,
|
|
2474
|
-
stacklevel=2,
|
|
2475
|
-
)
|
|
2476
|
-
|
|
2477
2391
|
if pyarrow is None:
|
|
2478
2392
|
raise ValueError(_NO_PYARROW_ERROR)
|
|
2479
2393
|
|
|
@@ -2991,18 +2905,12 @@ class RowIterator(HTTPIterator):
|
|
|
2991
2905
|
create_bqstorage_client = False
|
|
2992
2906
|
bqstorage_client = None
|
|
2993
2907
|
|
|
2994
|
-
|
|
2995
|
-
|
|
2996
|
-
|
|
2997
|
-
|
|
2998
|
-
|
|
2999
|
-
|
|
3000
|
-
record_batch = self.to_arrow(
|
|
3001
|
-
progress_bar_type=progress_bar_type,
|
|
3002
|
-
bqstorage_client=bqstorage_client,
|
|
3003
|
-
create_bqstorage_client=create_bqstorage_client,
|
|
3004
|
-
timeout=timeout,
|
|
3005
|
-
)
|
|
2908
|
+
record_batch = self.to_arrow(
|
|
2909
|
+
progress_bar_type=progress_bar_type,
|
|
2910
|
+
bqstorage_client=bqstorage_client,
|
|
2911
|
+
create_bqstorage_client=create_bqstorage_client,
|
|
2912
|
+
timeout=timeout,
|
|
2913
|
+
)
|
|
3006
2914
|
|
|
3007
2915
|
# Default date dtype is `db_dtypes.DateDtype()` that could cause out of bounds error,
|
|
3008
2916
|
# when pyarrow converts date values to nanosecond precision. To avoid the error, we
|
|
@@ -3278,11 +3186,6 @@ class _EmptyRowIterator(RowIterator):
|
|
|
3278
3186
|
"""
|
|
3279
3187
|
if pyarrow is None:
|
|
3280
3188
|
raise ValueError(_NO_PYARROW_ERROR)
|
|
3281
|
-
warnings.warn(
|
|
3282
|
-
_TO_ARROW_DEPRECATED,
|
|
3283
|
-
PendingDeprecationWarning,
|
|
3284
|
-
stacklevel=2,
|
|
3285
|
-
)
|
|
3286
3189
|
return pyarrow.Table.from_arrays(())
|
|
3287
3190
|
|
|
3288
3191
|
def to_dataframe(
|
|
@@ -1632,6 +1632,59 @@ class TestQueryJob(_Base):
|
|
|
1632
1632
|
tabledata_list_request_2[1]["query_params"]["maxResults"], page_size
|
|
1633
1633
|
)
|
|
1634
1634
|
|
|
1635
|
+
def test_result_with_start_index_and_max_results_multi_page(self):
|
|
1636
|
+
# When only max_results and start_index are set, the server may still
|
|
1637
|
+
# split the result into several pages (e.g. when a page would exceed
|
|
1638
|
+
# the response size limit). The follow-up requests carry a page token,
|
|
1639
|
+
# so they must not carry start_index as well, because the server only
|
|
1640
|
+
# allows one of them.
|
|
1641
|
+
query_resource = {
|
|
1642
|
+
"jobComplete": True,
|
|
1643
|
+
"jobReference": {"projectId": self.PROJECT, "jobId": self.JOB_ID},
|
|
1644
|
+
"schema": {"fields": [{"name": "col1", "type": "STRING"}]},
|
|
1645
|
+
"totalRows": "7",
|
|
1646
|
+
}
|
|
1647
|
+
tabledata_resource_1 = {
|
|
1648
|
+
"totalRows": "7",
|
|
1649
|
+
"pageToken": "page_token_1",
|
|
1650
|
+
"rows": [
|
|
1651
|
+
{"f": [{"v": "abc"}]},
|
|
1652
|
+
{"f": [{"v": "def"}]},
|
|
1653
|
+
],
|
|
1654
|
+
}
|
|
1655
|
+
tabledata_resource_2 = {
|
|
1656
|
+
"totalRows": "7",
|
|
1657
|
+
"rows": [
|
|
1658
|
+
{"f": [{"v": "ghi"}]},
|
|
1659
|
+
{"f": [{"v": "jkl"}]},
|
|
1660
|
+
],
|
|
1661
|
+
}
|
|
1662
|
+
|
|
1663
|
+
connection = make_connection(
|
|
1664
|
+
query_resource, tabledata_resource_1, tabledata_resource_2
|
|
1665
|
+
)
|
|
1666
|
+
client = _make_client(self.PROJECT, connection=connection)
|
|
1667
|
+
resource = self._make_resource(ended=True)
|
|
1668
|
+
job = self._get_target_class().from_api_repr(resource, client)
|
|
1669
|
+
|
|
1670
|
+
start_index = 1
|
|
1671
|
+
max_results = 4
|
|
1672
|
+
|
|
1673
|
+
rows = list(job.result(max_results=max_results, start_index=start_index))
|
|
1674
|
+
|
|
1675
|
+
self.assertEqual([row.col1 for row in rows], ["abc", "def", "ghi", "jkl"])
|
|
1676
|
+
self.assertEqual(len(connection.api_request.call_args_list), 3)
|
|
1677
|
+
|
|
1678
|
+
tabledata_list_request_1 = connection.api_request.call_args_list[1]
|
|
1679
|
+
self.assertEqual(
|
|
1680
|
+
tabledata_list_request_1[1]["query_params"]["startIndex"], start_index
|
|
1681
|
+
)
|
|
1682
|
+
|
|
1683
|
+
tabledata_list_request_2 = connection.api_request.call_args_list[2]
|
|
1684
|
+
query_params_2 = tabledata_list_request_2[1]["query_params"]
|
|
1685
|
+
self.assertEqual(query_params_2["pageToken"], "page_token_1")
|
|
1686
|
+
self.assertNotIn("startIndex", query_params_2)
|
|
1687
|
+
|
|
1635
1688
|
def test_result_error(self):
|
|
1636
1689
|
from google.cloud import exceptions
|
|
1637
1690
|
|
{google_cloud_bigquery-3.46.0 → google_cloud_bigquery-3.46.2}/tests/unit/test_external_config.py
RENAMED
|
@@ -81,6 +81,23 @@ class TestExternalConfig(unittest.TestCase):
|
|
|
81
81
|
got_resource = ec.to_api_repr()
|
|
82
82
|
self.assertEqual(got_resource, resource)
|
|
83
83
|
|
|
84
|
+
def test_from_api_repr_missing_source_format(self):
|
|
85
|
+
resource = copy.deepcopy(self.BASE_RESOURCE)
|
|
86
|
+
del resource["sourceFormat"]
|
|
87
|
+
|
|
88
|
+
ec = external_config.ExternalConfig.from_api_repr(resource)
|
|
89
|
+
self._verify_base(ec)
|
|
90
|
+
self.assertIsNone(ec.source_format)
|
|
91
|
+
self.assertIsNone(ec.options)
|
|
92
|
+
self.assertIsNone(ec.avro_options)
|
|
93
|
+
self.assertIsNone(ec.bigtable_options)
|
|
94
|
+
self.assertIsNone(ec.csv_options)
|
|
95
|
+
self.assertIsNone(ec.google_sheets_options)
|
|
96
|
+
self.assertIsNone(ec.parquet_options)
|
|
97
|
+
|
|
98
|
+
got_resource = ec.to_api_repr()
|
|
99
|
+
self.assertEqual(got_resource, resource)
|
|
100
|
+
|
|
84
101
|
def test_to_api_repr_base(self):
|
|
85
102
|
ec = external_config.ExternalConfig("")
|
|
86
103
|
ec.source_uris = self.SOURCE_URIS
|
|
@@ -193,7 +193,7 @@ class TestQueryResultsFormatOption1(unittest.TestCase):
|
|
|
193
193
|
mock_response.arrow_record_batch = None
|
|
194
194
|
mock_bqstorage.read_rows.return_value = [mock_response]
|
|
195
195
|
|
|
196
|
-
with mock.patch("google.cloud.bigquery.
|
|
196
|
+
with mock.patch("google.cloud.bigquery._arrow_query.pyarrow") as mock_pyarrow:
|
|
197
197
|
mock_pyarrow.py_buffer = lambda x: x
|
|
198
198
|
batches = list(iterator._download_arrow_from_job_id(timeout=5.0))
|
|
199
199
|
self.assertEqual(batches, [])
|
|
@@ -247,7 +247,7 @@ class TestQueryResultsFormatOption1(unittest.TestCase):
|
|
|
247
247
|
|
|
248
248
|
mock_bqstorage.read_rows.return_value = [mock_response]
|
|
249
249
|
|
|
250
|
-
with mock.patch("google.cloud.bigquery.
|
|
250
|
+
with mock.patch("google.cloud.bigquery._arrow_query.pyarrow") as mock_pyarrow:
|
|
251
251
|
mock_pyarrow.py_buffer = lambda x: x
|
|
252
252
|
mock_pyarrow.ipc.read_schema.return_value = "deserialized_schema"
|
|
253
253
|
mock_pyarrow.ipc.read_record_batch.side_effect = [
|
|
@@ -306,7 +306,7 @@ class TestQueryResultsFormatOption1(unittest.TestCase):
|
|
|
306
306
|
|
|
307
307
|
mock_bqstorage.read_rows.return_value = [mock_response]
|
|
308
308
|
|
|
309
|
-
with mock.patch("google.cloud.bigquery.
|
|
309
|
+
with mock.patch("google.cloud.bigquery._arrow_query.pyarrow") as mock_pyarrow:
|
|
310
310
|
mock_pyarrow.py_buffer = lambda x: x
|
|
311
311
|
mock_pyarrow.ipc.read_schema.return_value = "deserialized_schema"
|
|
312
312
|
mock_pyarrow.ipc.read_record_batch.return_value = mock_stream_batch
|
|
@@ -339,7 +339,7 @@ class TestQueryResultsFormatOption1(unittest.TestCase):
|
|
|
339
339
|
query_results_format="ARROW",
|
|
340
340
|
)
|
|
341
341
|
|
|
342
|
-
with mock.patch("google.cloud.bigquery.
|
|
342
|
+
with mock.patch("google.cloud.bigquery._arrow_query.pyarrow"):
|
|
343
343
|
with self.assertRaises(ValueError) as ctx:
|
|
344
344
|
list(iterator._download_arrow_from_job_id())
|
|
345
345
|
self.assertIn(
|
|
@@ -374,7 +374,7 @@ class TestQueryResultsFormatOption1(unittest.TestCase):
|
|
|
374
374
|
|
|
375
375
|
mock_bqstorage.read_rows.return_value = [mock_response]
|
|
376
376
|
|
|
377
|
-
with mock.patch("google.cloud.bigquery.
|
|
377
|
+
with mock.patch("google.cloud.bigquery._arrow_query.pyarrow") as mock_pyarrow:
|
|
378
378
|
mock_pyarrow.py_buffer = lambda x: x
|
|
379
379
|
mock_pyarrow.ipc.read_schema.return_value = "fake_schema"
|
|
380
380
|
mock_pyarrow.ipc.read_record_batch.return_value = "fake_batch"
|
|
@@ -422,7 +422,7 @@ class TestQueryResultsFormatOption1(unittest.TestCase):
|
|
|
422
422
|
mock_first_batch = mock.MagicMock()
|
|
423
423
|
mock_first_batch.num_rows = 10
|
|
424
424
|
|
|
425
|
-
with mock.patch("google.cloud.bigquery.
|
|
425
|
+
with mock.patch("google.cloud.bigquery._arrow_query.pyarrow") as mock_pyarrow:
|
|
426
426
|
mock_pyarrow.py_buffer = lambda x: x
|
|
427
427
|
mock_pyarrow.ipc.read_schema.return_value = "deserialized_schema"
|
|
428
428
|
mock_pyarrow.ipc.read_record_batch.return_value = mock_first_batch
|
|
@@ -464,7 +464,7 @@ class TestQueryResultsFormatOption1(unittest.TestCase):
|
|
|
464
464
|
mock_first_batch.num_rows = 10
|
|
465
465
|
mock_bqstorage.read_rows.return_value = []
|
|
466
466
|
|
|
467
|
-
with mock.patch("google.cloud.bigquery.
|
|
467
|
+
with mock.patch("google.cloud.bigquery._arrow_query.pyarrow") as mock_pyarrow:
|
|
468
468
|
mock_pyarrow.py_buffer = lambda x: x
|
|
469
469
|
mock_pyarrow.ipc.read_schema.return_value = "deserialized_schema"
|
|
470
470
|
mock_pyarrow.ipc.read_record_batch.return_value = mock_first_batch
|