google-cloud-bigquery 3.24.0__tar.gz → 3.25.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.
Files changed (153) hide show
  1. {google-cloud-bigquery-3.24.0/google_cloud_bigquery.egg-info → google-cloud-bigquery-3.25.0}/PKG-INFO +1 -1
  2. {google-cloud-bigquery-3.24.0 → google-cloud-bigquery-3.25.0}/google/cloud/bigquery/dbapi/connection.py +20 -10
  3. {google-cloud-bigquery-3.24.0 → google-cloud-bigquery-3.25.0}/google/cloud/bigquery/job/load.py +41 -0
  4. {google-cloud-bigquery-3.24.0 → google-cloud-bigquery-3.25.0}/google/cloud/bigquery/job/query.py +3 -2
  5. {google-cloud-bigquery-3.24.0 → google-cloud-bigquery-3.25.0}/google/cloud/bigquery/version.py +1 -1
  6. {google-cloud-bigquery-3.24.0 → google-cloud-bigquery-3.25.0/google_cloud_bigquery.egg-info}/PKG-INFO +1 -1
  7. {google-cloud-bigquery-3.24.0 → google-cloud-bigquery-3.25.0}/tests/system/test_client.py +22 -7
  8. {google-cloud-bigquery-3.24.0 → google-cloud-bigquery-3.25.0}/tests/unit/job/test_load_config.py +39 -0
  9. {google-cloud-bigquery-3.24.0 → google-cloud-bigquery-3.25.0}/tests/unit/job/test_query.py +14 -1
  10. {google-cloud-bigquery-3.24.0 → google-cloud-bigquery-3.25.0}/tests/unit/test_dbapi_connection.py +20 -0
  11. {google-cloud-bigquery-3.24.0 → google-cloud-bigquery-3.25.0}/LICENSE +0 -0
  12. {google-cloud-bigquery-3.24.0 → google-cloud-bigquery-3.25.0}/MANIFEST.in +0 -0
  13. {google-cloud-bigquery-3.24.0 → google-cloud-bigquery-3.25.0}/README.rst +0 -0
  14. {google-cloud-bigquery-3.24.0 → google-cloud-bigquery-3.25.0}/google/cloud/bigquery/__init__.py +0 -0
  15. {google-cloud-bigquery-3.24.0 → google-cloud-bigquery-3.25.0}/google/cloud/bigquery/_helpers.py +0 -0
  16. {google-cloud-bigquery-3.24.0 → google-cloud-bigquery-3.25.0}/google/cloud/bigquery/_http.py +0 -0
  17. {google-cloud-bigquery-3.24.0 → google-cloud-bigquery-3.25.0}/google/cloud/bigquery/_job_helpers.py +0 -0
  18. {google-cloud-bigquery-3.24.0 → google-cloud-bigquery-3.25.0}/google/cloud/bigquery/_pandas_helpers.py +0 -0
  19. {google-cloud-bigquery-3.24.0 → google-cloud-bigquery-3.25.0}/google/cloud/bigquery/_pyarrow_helpers.py +0 -0
  20. {google-cloud-bigquery-3.24.0 → google-cloud-bigquery-3.25.0}/google/cloud/bigquery/_tqdm_helpers.py +0 -0
  21. {google-cloud-bigquery-3.24.0 → google-cloud-bigquery-3.25.0}/google/cloud/bigquery/_versions_helpers.py +0 -0
  22. {google-cloud-bigquery-3.24.0 → google-cloud-bigquery-3.25.0}/google/cloud/bigquery/client.py +0 -0
  23. {google-cloud-bigquery-3.24.0 → google-cloud-bigquery-3.25.0}/google/cloud/bigquery/dataset.py +0 -0
  24. {google-cloud-bigquery-3.24.0 → google-cloud-bigquery-3.25.0}/google/cloud/bigquery/dbapi/__init__.py +0 -0
  25. {google-cloud-bigquery-3.24.0 → google-cloud-bigquery-3.25.0}/google/cloud/bigquery/dbapi/_helpers.py +0 -0
  26. {google-cloud-bigquery-3.24.0 → google-cloud-bigquery-3.25.0}/google/cloud/bigquery/dbapi/cursor.py +0 -0
  27. {google-cloud-bigquery-3.24.0 → google-cloud-bigquery-3.25.0}/google/cloud/bigquery/dbapi/exceptions.py +0 -0
  28. {google-cloud-bigquery-3.24.0 → google-cloud-bigquery-3.25.0}/google/cloud/bigquery/dbapi/types.py +0 -0
  29. {google-cloud-bigquery-3.24.0 → google-cloud-bigquery-3.25.0}/google/cloud/bigquery/encryption_configuration.py +0 -0
  30. {google-cloud-bigquery-3.24.0 → google-cloud-bigquery-3.25.0}/google/cloud/bigquery/enums.py +0 -0
  31. {google-cloud-bigquery-3.24.0 → google-cloud-bigquery-3.25.0}/google/cloud/bigquery/exceptions.py +0 -0
  32. {google-cloud-bigquery-3.24.0 → google-cloud-bigquery-3.25.0}/google/cloud/bigquery/external_config.py +0 -0
  33. {google-cloud-bigquery-3.24.0 → google-cloud-bigquery-3.25.0}/google/cloud/bigquery/format_options.py +0 -0
  34. {google-cloud-bigquery-3.24.0 → google-cloud-bigquery-3.25.0}/google/cloud/bigquery/iam.py +0 -0
  35. {google-cloud-bigquery-3.24.0 → google-cloud-bigquery-3.25.0}/google/cloud/bigquery/job/__init__.py +0 -0
  36. {google-cloud-bigquery-3.24.0 → google-cloud-bigquery-3.25.0}/google/cloud/bigquery/job/base.py +0 -0
  37. {google-cloud-bigquery-3.24.0 → google-cloud-bigquery-3.25.0}/google/cloud/bigquery/job/copy_.py +0 -0
  38. {google-cloud-bigquery-3.24.0 → google-cloud-bigquery-3.25.0}/google/cloud/bigquery/job/extract.py +0 -0
  39. {google-cloud-bigquery-3.24.0 → google-cloud-bigquery-3.25.0}/google/cloud/bigquery/magics/__init__.py +0 -0
  40. {google-cloud-bigquery-3.24.0 → google-cloud-bigquery-3.25.0}/google/cloud/bigquery/magics/line_arg_parser/__init__.py +0 -0
  41. {google-cloud-bigquery-3.24.0 → google-cloud-bigquery-3.25.0}/google/cloud/bigquery/magics/line_arg_parser/exceptions.py +0 -0
  42. {google-cloud-bigquery-3.24.0 → google-cloud-bigquery-3.25.0}/google/cloud/bigquery/magics/line_arg_parser/lexer.py +0 -0
  43. {google-cloud-bigquery-3.24.0 → google-cloud-bigquery-3.25.0}/google/cloud/bigquery/magics/line_arg_parser/parser.py +0 -0
  44. {google-cloud-bigquery-3.24.0 → google-cloud-bigquery-3.25.0}/google/cloud/bigquery/magics/line_arg_parser/visitors.py +0 -0
  45. {google-cloud-bigquery-3.24.0 → google-cloud-bigquery-3.25.0}/google/cloud/bigquery/magics/magics.py +0 -0
  46. {google-cloud-bigquery-3.24.0 → google-cloud-bigquery-3.25.0}/google/cloud/bigquery/model.py +0 -0
  47. {google-cloud-bigquery-3.24.0 → google-cloud-bigquery-3.25.0}/google/cloud/bigquery/opentelemetry_tracing.py +0 -0
  48. {google-cloud-bigquery-3.24.0 → google-cloud-bigquery-3.25.0}/google/cloud/bigquery/py.typed +0 -0
  49. {google-cloud-bigquery-3.24.0 → google-cloud-bigquery-3.25.0}/google/cloud/bigquery/query.py +0 -0
  50. {google-cloud-bigquery-3.24.0 → google-cloud-bigquery-3.25.0}/google/cloud/bigquery/retry.py +0 -0
  51. {google-cloud-bigquery-3.24.0 → google-cloud-bigquery-3.25.0}/google/cloud/bigquery/routine/__init__.py +0 -0
  52. {google-cloud-bigquery-3.24.0 → google-cloud-bigquery-3.25.0}/google/cloud/bigquery/routine/routine.py +0 -0
  53. {google-cloud-bigquery-3.24.0 → google-cloud-bigquery-3.25.0}/google/cloud/bigquery/schema.py +0 -0
  54. {google-cloud-bigquery-3.24.0 → google-cloud-bigquery-3.25.0}/google/cloud/bigquery/standard_sql.py +0 -0
  55. {google-cloud-bigquery-3.24.0 → google-cloud-bigquery-3.25.0}/google/cloud/bigquery/table.py +0 -0
  56. {google-cloud-bigquery-3.24.0 → google-cloud-bigquery-3.25.0}/google/cloud/bigquery_v2/__init__.py +0 -0
  57. {google-cloud-bigquery-3.24.0 → google-cloud-bigquery-3.25.0}/google/cloud/bigquery_v2/types/__init__.py +0 -0
  58. {google-cloud-bigquery-3.24.0 → google-cloud-bigquery-3.25.0}/google/cloud/bigquery_v2/types/encryption_config.py +0 -0
  59. {google-cloud-bigquery-3.24.0 → google-cloud-bigquery-3.25.0}/google/cloud/bigquery_v2/types/model.py +0 -0
  60. {google-cloud-bigquery-3.24.0 → google-cloud-bigquery-3.25.0}/google/cloud/bigquery_v2/types/model_reference.py +0 -0
  61. {google-cloud-bigquery-3.24.0 → google-cloud-bigquery-3.25.0}/google/cloud/bigquery_v2/types/standard_sql.py +0 -0
  62. {google-cloud-bigquery-3.24.0 → google-cloud-bigquery-3.25.0}/google/cloud/bigquery_v2/types/table_reference.py +0 -0
  63. {google-cloud-bigquery-3.24.0 → google-cloud-bigquery-3.25.0}/google_cloud_bigquery.egg-info/SOURCES.txt +0 -0
  64. {google-cloud-bigquery-3.24.0 → google-cloud-bigquery-3.25.0}/google_cloud_bigquery.egg-info/dependency_links.txt +0 -0
  65. {google-cloud-bigquery-3.24.0 → google-cloud-bigquery-3.25.0}/google_cloud_bigquery.egg-info/not-zip-safe +0 -0
  66. {google-cloud-bigquery-3.24.0 → google-cloud-bigquery-3.25.0}/google_cloud_bigquery.egg-info/requires.txt +0 -0
  67. {google-cloud-bigquery-3.24.0 → google-cloud-bigquery-3.25.0}/google_cloud_bigquery.egg-info/top_level.txt +0 -0
  68. {google-cloud-bigquery-3.24.0 → google-cloud-bigquery-3.25.0}/setup.cfg +0 -0
  69. {google-cloud-bigquery-3.24.0 → google-cloud-bigquery-3.25.0}/setup.py +0 -0
  70. {google-cloud-bigquery-3.24.0 → google-cloud-bigquery-3.25.0}/tests/__init__.py +0 -0
  71. {google-cloud-bigquery-3.24.0 → google-cloud-bigquery-3.25.0}/tests/data/characters.json +0 -0
  72. {google-cloud-bigquery-3.24.0 → google-cloud-bigquery-3.25.0}/tests/data/characters.jsonl +0 -0
  73. {google-cloud-bigquery-3.24.0 → google-cloud-bigquery-3.25.0}/tests/data/colors.avro +0 -0
  74. {google-cloud-bigquery-3.24.0 → google-cloud-bigquery-3.25.0}/tests/data/numeric_38_12.parquet +0 -0
  75. {google-cloud-bigquery-3.24.0 → google-cloud-bigquery-3.25.0}/tests/data/people.csv +0 -0
  76. {google-cloud-bigquery-3.24.0 → google-cloud-bigquery-3.25.0}/tests/data/scalars.csv +0 -0
  77. {google-cloud-bigquery-3.24.0 → google-cloud-bigquery-3.25.0}/tests/data/scalars.jsonl +0 -0
  78. {google-cloud-bigquery-3.24.0 → google-cloud-bigquery-3.25.0}/tests/data/scalars_extreme.jsonl +0 -0
  79. {google-cloud-bigquery-3.24.0 → google-cloud-bigquery-3.25.0}/tests/data/scalars_schema.json +0 -0
  80. {google-cloud-bigquery-3.24.0 → google-cloud-bigquery-3.25.0}/tests/data/scalars_schema_csv.json +0 -0
  81. {google-cloud-bigquery-3.24.0 → google-cloud-bigquery-3.25.0}/tests/data/schema.json +0 -0
  82. {google-cloud-bigquery-3.24.0 → google-cloud-bigquery-3.25.0}/tests/scrub_datasets.py +0 -0
  83. {google-cloud-bigquery-3.24.0 → google-cloud-bigquery-3.25.0}/tests/system/__init__.py +0 -0
  84. {google-cloud-bigquery-3.24.0 → google-cloud-bigquery-3.25.0}/tests/system/conftest.py +0 -0
  85. {google-cloud-bigquery-3.24.0 → google-cloud-bigquery-3.25.0}/tests/system/helpers.py +0 -0
  86. {google-cloud-bigquery-3.24.0 → google-cloud-bigquery-3.25.0}/tests/system/test_arrow.py +0 -0
  87. {google-cloud-bigquery-3.24.0 → google-cloud-bigquery-3.25.0}/tests/system/test_job_retry.py +0 -0
  88. {google-cloud-bigquery-3.24.0 → google-cloud-bigquery-3.25.0}/tests/system/test_list_rows.py +0 -0
  89. {google-cloud-bigquery-3.24.0 → google-cloud-bigquery-3.25.0}/tests/system/test_magics.py +0 -0
  90. {google-cloud-bigquery-3.24.0 → google-cloud-bigquery-3.25.0}/tests/system/test_pandas.py +0 -0
  91. {google-cloud-bigquery-3.24.0 → google-cloud-bigquery-3.25.0}/tests/system/test_query.py +0 -0
  92. {google-cloud-bigquery-3.24.0 → google-cloud-bigquery-3.25.0}/tests/system/test_structs.py +0 -0
  93. {google-cloud-bigquery-3.24.0 → google-cloud-bigquery-3.25.0}/tests/unit/__init__.py +0 -0
  94. {google-cloud-bigquery-3.24.0 → google-cloud-bigquery-3.25.0}/tests/unit/_helpers/__init__.py +0 -0
  95. {google-cloud-bigquery-3.24.0 → google-cloud-bigquery-3.25.0}/tests/unit/_helpers/test_from_json.py +0 -0
  96. {google-cloud-bigquery-3.24.0 → google-cloud-bigquery-3.25.0}/tests/unit/conftest.py +0 -0
  97. {google-cloud-bigquery-3.24.0 → google-cloud-bigquery-3.25.0}/tests/unit/helpers.py +0 -0
  98. {google-cloud-bigquery-3.24.0 → google-cloud-bigquery-3.25.0}/tests/unit/job/__init__.py +0 -0
  99. {google-cloud-bigquery-3.24.0 → google-cloud-bigquery-3.25.0}/tests/unit/job/helpers.py +0 -0
  100. {google-cloud-bigquery-3.24.0 → google-cloud-bigquery-3.25.0}/tests/unit/job/test_base.py +0 -0
  101. {google-cloud-bigquery-3.24.0 → google-cloud-bigquery-3.25.0}/tests/unit/job/test_copy.py +0 -0
  102. {google-cloud-bigquery-3.24.0 → google-cloud-bigquery-3.25.0}/tests/unit/job/test_extract.py +0 -0
  103. {google-cloud-bigquery-3.24.0 → google-cloud-bigquery-3.25.0}/tests/unit/job/test_load.py +0 -0
  104. {google-cloud-bigquery-3.24.0 → google-cloud-bigquery-3.25.0}/tests/unit/job/test_query_config.py +0 -0
  105. {google-cloud-bigquery-3.24.0 → google-cloud-bigquery-3.25.0}/tests/unit/job/test_query_pandas.py +0 -0
  106. {google-cloud-bigquery-3.24.0 → google-cloud-bigquery-3.25.0}/tests/unit/job/test_query_stats.py +0 -0
  107. {google-cloud-bigquery-3.24.0 → google-cloud-bigquery-3.25.0}/tests/unit/line_arg_parser/__init__.py +0 -0
  108. {google-cloud-bigquery-3.24.0 → google-cloud-bigquery-3.25.0}/tests/unit/line_arg_parser/test_lexer.py +0 -0
  109. {google-cloud-bigquery-3.24.0 → google-cloud-bigquery-3.25.0}/tests/unit/line_arg_parser/test_parser.py +0 -0
  110. {google-cloud-bigquery-3.24.0 → google-cloud-bigquery-3.25.0}/tests/unit/line_arg_parser/test_visitors.py +0 -0
  111. {google-cloud-bigquery-3.24.0 → google-cloud-bigquery-3.25.0}/tests/unit/model/__init__.py +0 -0
  112. {google-cloud-bigquery-3.24.0 → google-cloud-bigquery-3.25.0}/tests/unit/model/test_model.py +0 -0
  113. {google-cloud-bigquery-3.24.0 → google-cloud-bigquery-3.25.0}/tests/unit/model/test_model_reference.py +0 -0
  114. {google-cloud-bigquery-3.24.0 → google-cloud-bigquery-3.25.0}/tests/unit/routine/__init__.py +0 -0
  115. {google-cloud-bigquery-3.24.0 → google-cloud-bigquery-3.25.0}/tests/unit/routine/test_remote_function_options.py +0 -0
  116. {google-cloud-bigquery-3.24.0 → google-cloud-bigquery-3.25.0}/tests/unit/routine/test_routine.py +0 -0
  117. {google-cloud-bigquery-3.24.0 → google-cloud-bigquery-3.25.0}/tests/unit/routine/test_routine_argument.py +0 -0
  118. {google-cloud-bigquery-3.24.0 → google-cloud-bigquery-3.25.0}/tests/unit/routine/test_routine_reference.py +0 -0
  119. {google-cloud-bigquery-3.24.0 → google-cloud-bigquery-3.25.0}/tests/unit/test__helpers.py +0 -0
  120. {google-cloud-bigquery-3.24.0 → google-cloud-bigquery-3.25.0}/tests/unit/test__http.py +0 -0
  121. {google-cloud-bigquery-3.24.0 → google-cloud-bigquery-3.25.0}/tests/unit/test__job_helpers.py +0 -0
  122. {google-cloud-bigquery-3.24.0 → google-cloud-bigquery-3.25.0}/tests/unit/test__pandas_helpers.py +0 -0
  123. {google-cloud-bigquery-3.24.0 → google-cloud-bigquery-3.25.0}/tests/unit/test__pyarrow_helpers.py +0 -0
  124. {google-cloud-bigquery-3.24.0 → google-cloud-bigquery-3.25.0}/tests/unit/test__versions_helpers.py +0 -0
  125. {google-cloud-bigquery-3.24.0 → google-cloud-bigquery-3.25.0}/tests/unit/test_client.py +0 -0
  126. {google-cloud-bigquery-3.24.0 → google-cloud-bigquery-3.25.0}/tests/unit/test_create_dataset.py +0 -0
  127. {google-cloud-bigquery-3.24.0 → google-cloud-bigquery-3.25.0}/tests/unit/test_dataset.py +0 -0
  128. {google-cloud-bigquery-3.24.0 → google-cloud-bigquery-3.25.0}/tests/unit/test_dbapi__helpers.py +0 -0
  129. {google-cloud-bigquery-3.24.0 → google-cloud-bigquery-3.25.0}/tests/unit/test_dbapi_cursor.py +0 -0
  130. {google-cloud-bigquery-3.24.0 → google-cloud-bigquery-3.25.0}/tests/unit/test_dbapi_types.py +0 -0
  131. {google-cloud-bigquery-3.24.0 → google-cloud-bigquery-3.25.0}/tests/unit/test_delete_dataset.py +0 -0
  132. {google-cloud-bigquery-3.24.0 → google-cloud-bigquery-3.25.0}/tests/unit/test_encryption_configuration.py +0 -0
  133. {google-cloud-bigquery-3.24.0 → google-cloud-bigquery-3.25.0}/tests/unit/test_external_config.py +0 -0
  134. {google-cloud-bigquery-3.24.0 → google-cloud-bigquery-3.25.0}/tests/unit/test_format_options.py +0 -0
  135. {google-cloud-bigquery-3.24.0 → google-cloud-bigquery-3.25.0}/tests/unit/test_job_retry.py +0 -0
  136. {google-cloud-bigquery-3.24.0 → google-cloud-bigquery-3.25.0}/tests/unit/test_legacy_types.py +0 -0
  137. {google-cloud-bigquery-3.24.0 → google-cloud-bigquery-3.25.0}/tests/unit/test_list_datasets.py +0 -0
  138. {google-cloud-bigquery-3.24.0 → google-cloud-bigquery-3.25.0}/tests/unit/test_list_jobs.py +0 -0
  139. {google-cloud-bigquery-3.24.0 → google-cloud-bigquery-3.25.0}/tests/unit/test_list_models.py +0 -0
  140. {google-cloud-bigquery-3.24.0 → google-cloud-bigquery-3.25.0}/tests/unit/test_list_projects.py +0 -0
  141. {google-cloud-bigquery-3.24.0 → google-cloud-bigquery-3.25.0}/tests/unit/test_list_routines.py +0 -0
  142. {google-cloud-bigquery-3.24.0 → google-cloud-bigquery-3.25.0}/tests/unit/test_list_tables.py +0 -0
  143. {google-cloud-bigquery-3.24.0 → google-cloud-bigquery-3.25.0}/tests/unit/test_magics.py +0 -0
  144. {google-cloud-bigquery-3.24.0 → google-cloud-bigquery-3.25.0}/tests/unit/test_opentelemetry_tracing.py +0 -0
  145. {google-cloud-bigquery-3.24.0 → google-cloud-bigquery-3.25.0}/tests/unit/test_packaging.py +0 -0
  146. {google-cloud-bigquery-3.24.0 → google-cloud-bigquery-3.25.0}/tests/unit/test_query.py +0 -0
  147. {google-cloud-bigquery-3.24.0 → google-cloud-bigquery-3.25.0}/tests/unit/test_retry.py +0 -0
  148. {google-cloud-bigquery-3.24.0 → google-cloud-bigquery-3.25.0}/tests/unit/test_schema.py +0 -0
  149. {google-cloud-bigquery-3.24.0 → google-cloud-bigquery-3.25.0}/tests/unit/test_signature_compatibility.py +0 -0
  150. {google-cloud-bigquery-3.24.0 → google-cloud-bigquery-3.25.0}/tests/unit/test_standard_sql_types.py +0 -0
  151. {google-cloud-bigquery-3.24.0 → google-cloud-bigquery-3.25.0}/tests/unit/test_table.py +0 -0
  152. {google-cloud-bigquery-3.24.0 → google-cloud-bigquery-3.25.0}/tests/unit/test_table_arrow.py +0 -0
  153. {google-cloud-bigquery-3.24.0 → google-cloud-bigquery-3.25.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.24.0
3
+ Version: 3.25.0
4
4
  Summary: Google BigQuery API client library
5
5
  Home-page: https://github.com/googleapis/python-bigquery
6
6
  Author: Google LLC
@@ -35,12 +35,18 @@ class Connection(object):
35
35
  A client that uses the faster BigQuery Storage API to fetch rows from
36
36
  BigQuery. If not passed, it is created using the same credentials
37
37
  as ``client`` (provided that BigQuery Storage dependencies are installed).
38
-
39
- If both clients are available, ``bqstorage_client`` is used for
40
- fetching query results.
38
+ prefer_bqstorage_client (Optional[bool]):
39
+ Prefer the BigQuery Storage client over the REST client. If Storage
40
+ client isn't available, fall back to the REST client. Defaults to
41
+ ``True``.
41
42
  """
42
43
 
43
- def __init__(self, client=None, bqstorage_client=None):
44
+ def __init__(
45
+ self,
46
+ client=None,
47
+ bqstorage_client=None,
48
+ prefer_bqstorage_client=True,
49
+ ):
44
50
  if client is None:
45
51
  client = bigquery.Client()
46
52
  self._owns_client = True
@@ -49,7 +55,10 @@ class Connection(object):
49
55
 
50
56
  # A warning is already raised by the BQ Storage client factory factory if
51
57
  # instantiation fails, or if the given BQ Storage client instance is outdated.
52
- if bqstorage_client is None:
58
+ if not prefer_bqstorage_client:
59
+ bqstorage_client = None
60
+ self._owns_bqstorage_client = False
61
+ elif bqstorage_client is None:
53
62
  bqstorage_client = client._ensure_bqstorage_client()
54
63
  self._owns_bqstorage_client = bqstorage_client is not None
55
64
  else:
@@ -95,7 +104,7 @@ class Connection(object):
95
104
  return new_cursor
96
105
 
97
106
 
98
- def connect(client=None, bqstorage_client=None):
107
+ def connect(client=None, bqstorage_client=None, prefer_bqstorage_client=True):
99
108
  """Construct a DB-API connection to Google BigQuery.
100
109
 
101
110
  Args:
@@ -108,11 +117,12 @@ def connect(client=None, bqstorage_client=None):
108
117
  A client that uses the faster BigQuery Storage API to fetch rows from
109
118
  BigQuery. If not passed, it is created using the same credentials
110
119
  as ``client`` (provided that BigQuery Storage dependencies are installed).
111
-
112
- If both clients are available, ``bqstorage_client`` is used for
113
- fetching query results.
120
+ prefer_bqstorage_client (Optional[bool]):
121
+ Prefer the BigQuery Storage client over the REST client. If Storage
122
+ client isn't available, fall back to the REST client. Defaults to
123
+ ``True``.
114
124
 
115
125
  Returns:
116
126
  google.cloud.bigquery.dbapi.Connection: A new DB-API connection to BigQuery.
117
127
  """
118
- return Connection(client, bqstorage_client)
128
+ return Connection(client, bqstorage_client, prefer_bqstorage_client)
@@ -32,6 +32,26 @@ from google.cloud.bigquery.job.base import _JobReference
32
32
  from google.cloud.bigquery.query import ConnectionProperty
33
33
 
34
34
 
35
+ class ColumnNameCharacterMap:
36
+ """Indicates the character map used for column names.
37
+
38
+ https://cloud.google.com/bigquery/docs/reference/rest/v2/Job#columnnamecharactermap
39
+ """
40
+
41
+ COLUMN_NAME_CHARACTER_MAP_UNSPECIFIED = "COLUMN_NAME_CHARACTER_MAP_UNSPECIFIED"
42
+ """Unspecified column name character map."""
43
+
44
+ STRICT = "STRICT"
45
+ """Support flexible column name and reject invalid column names."""
46
+
47
+ V1 = "V1"
48
+ """ Support alphanumeric + underscore characters and names must start with
49
+ a letter or underscore. Invalid column names will be normalized."""
50
+
51
+ V2 = "V2"
52
+ """Support flexible column name. Invalid column names will be normalized."""
53
+
54
+
35
55
  class LoadJobConfig(_JobConfig):
36
56
  """Configuration options for load jobs.
37
57
 
@@ -597,6 +617,27 @@ class LoadJobConfig(_JobConfig):
597
617
  else:
598
618
  self._del_sub_prop("parquetOptions")
599
619
 
620
+ @property
621
+ def column_name_character_map(self) -> str:
622
+ """Optional[google.cloud.bigquery.job.ColumnNameCharacterMap]:
623
+ Character map supported for column names in CSV/Parquet loads. Defaults
624
+ to STRICT and can be overridden by Project Config Service. Using this
625
+ option with unsupported load formats will result in an error.
626
+
627
+ See
628
+ https://cloud.google.com/bigquery/docs/reference/rest/v2/Job#JobConfigurationLoad.FIELDS.column_name_character_map
629
+ """
630
+ return self._get_sub_prop(
631
+ "columnNameCharacterMap",
632
+ ColumnNameCharacterMap.COLUMN_NAME_CHARACTER_MAP_UNSPECIFIED,
633
+ )
634
+
635
+ @column_name_character_map.setter
636
+ def column_name_character_map(self, value: Optional[str]):
637
+ if value is None:
638
+ value = ColumnNameCharacterMap.COLUMN_NAME_CHARACTER_MAP_UNSPECIFIED
639
+ self._set_sub_prop("columnNameCharacterMap", value)
640
+
600
641
 
601
642
  class LoadJob(_AsyncJob):
602
643
  """Asynchronous job for loading data into a table.
@@ -1532,8 +1532,9 @@ class QueryJob(_AsyncJob):
1532
1532
  # Setting max_results should be equivalent to setting page_size with
1533
1533
  # regards to allowing the user to tune how many results to download
1534
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:
1535
+ # 344008814. But if start_index is set, user is trying to access a
1536
+ # specific page, so we don't need to set page_size. See issue #1950.
1537
+ if page_size is None and max_results is not None and start_index is None:
1537
1538
  page_size = max_results
1538
1539
 
1539
1540
  # When timeout has default sentinel value ``object()``, do not pass
@@ -12,4 +12,4 @@
12
12
  # See the License for the specific language governing permissions and
13
13
  # limitations under the License.
14
14
 
15
- __version__ = "3.24.0"
15
+ __version__ = "3.25.0"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: google-cloud-bigquery
3
- Version: 3.24.0
3
+ Version: 3.25.0
4
4
  Summary: Google BigQuery API client library
5
5
  Home-page: https://github.com/googleapis/python-bigquery
6
6
  Author: Google LLC
@@ -1788,20 +1788,35 @@ class TestBigQuery(unittest.TestCase):
1788
1788
  # in the sorted order.
1789
1789
 
1790
1790
  expected_data = [
1791
+ [
1792
+ ("by", "pg"),
1793
+ ("id", 1),
1794
+ (
1795
+ "timestamp",
1796
+ datetime.datetime(
1797
+ 2006, 10, 9, 18, 21, 51, tzinfo=datetime.timezone.utc
1798
+ ),
1799
+ ),
1800
+ ],
1791
1801
  [
1792
1802
  ("by", "phyllis"),
1793
1803
  ("id", 2),
1794
- ("timestamp", datetime.datetime(2006, 10, 9, 18, 30, 28, tzinfo=UTC)),
1804
+ (
1805
+ "timestamp",
1806
+ datetime.datetime(
1807
+ 2006, 10, 9, 18, 30, 28, tzinfo=datetime.timezone.utc
1808
+ ),
1809
+ ),
1795
1810
  ],
1796
1811
  [
1797
1812
  ("by", "phyllis"),
1798
1813
  ("id", 3),
1799
- ("timestamp", datetime.datetime(2006, 10, 9, 18, 40, 33, tzinfo=UTC)),
1800
- ],
1801
- [
1802
- ("by", "onebeerdave"),
1803
- ("id", 4),
1804
- ("timestamp", datetime.datetime(2006, 10, 9, 18, 47, 42, tzinfo=UTC)),
1814
+ (
1815
+ "timestamp",
1816
+ datetime.datetime(
1817
+ 2006, 10, 9, 18, 40, 33, tzinfo=datetime.timezone.utc
1818
+ ),
1819
+ ),
1805
1820
  ],
1806
1821
  ]
1807
1822
 
@@ -843,3 +843,42 @@ class TestLoadJobConfig(_Base):
843
843
 
844
844
  config.parquet_options = None
845
845
  self.assertNotIn("parquetOptions", config._properties["load"])
846
+
847
+ def test_column_name_character_map_missing(self):
848
+ from google.cloud.bigquery.job.load import ColumnNameCharacterMap
849
+
850
+ config = self._get_target_class()()
851
+ self.assertEqual(
852
+ config.column_name_character_map,
853
+ ColumnNameCharacterMap.COLUMN_NAME_CHARACTER_MAP_UNSPECIFIED,
854
+ )
855
+
856
+ def test_column_name_character_map_hit(self):
857
+ from google.cloud.bigquery.job.load import ColumnNameCharacterMap
858
+
859
+ config = self._get_target_class()()
860
+ config._properties["load"]["columnNameCharacterMap"] = "STRICT"
861
+ self.assertEqual(
862
+ config.column_name_character_map,
863
+ ColumnNameCharacterMap.STRICT,
864
+ )
865
+
866
+ def test_column_name_character_map_setter(self):
867
+ from google.cloud.bigquery.job.load import ColumnNameCharacterMap
868
+
869
+ config = self._get_target_class()()
870
+ config.column_name_character_map = "V1"
871
+ self.assertEqual(
872
+ config._properties["load"]["columnNameCharacterMap"],
873
+ ColumnNameCharacterMap.V1,
874
+ )
875
+
876
+ def test_column_name_character_map_none(self):
877
+ from google.cloud.bigquery.job.load import ColumnNameCharacterMap
878
+
879
+ config = self._get_target_class()()
880
+ config.column_name_character_map = None
881
+ self.assertEqual(
882
+ config._properties["load"]["columnNameCharacterMap"],
883
+ ColumnNameCharacterMap.COLUMN_NAME_CHARACTER_MAP_UNSPECIFIED,
884
+ )
@@ -1652,7 +1652,17 @@ class TestQueryJob(_Base):
1652
1652
 
1653
1653
  start_index = 1
1654
1654
 
1655
- result = job.result(start_index=start_index)
1655
+ # Verifies that page_size isn't overwritten by max_results when
1656
+ # start_index is not None. See
1657
+ # https://github.com/googleapis/python-bigquery/issues/1950
1658
+ page_size = 10
1659
+ max_results = 100
1660
+
1661
+ result = job.result(
1662
+ page_size=page_size,
1663
+ max_results=max_results,
1664
+ start_index=start_index,
1665
+ )
1656
1666
 
1657
1667
  self.assertIsInstance(result, RowIterator)
1658
1668
  self.assertEqual(result.total_rows, 5)
@@ -1665,6 +1675,9 @@ class TestQueryJob(_Base):
1665
1675
  self.assertEqual(
1666
1676
  tabledata_list_request[1]["query_params"]["startIndex"], start_index
1667
1677
  )
1678
+ self.assertEqual(
1679
+ tabledata_list_request[1]["query_params"]["maxResults"], page_size
1680
+ )
1668
1681
 
1669
1682
  def test_result_error(self):
1670
1683
  from google.cloud import exceptions
@@ -122,6 +122,26 @@ class TestConnection(unittest.TestCase):
122
122
  self.assertIs(connection._client, mock_client)
123
123
  self.assertIs(connection._bqstorage_client, mock_bqstorage_client)
124
124
 
125
+ def test_connect_prefer_bqstorage_client_false(self):
126
+ pytest.importorskip("google.cloud.bigquery_storage")
127
+ from google.cloud.bigquery.dbapi import connect
128
+ from google.cloud.bigquery.dbapi import Connection
129
+
130
+ mock_client = self._mock_client()
131
+ mock_bqstorage_client = self._mock_bqstorage_client()
132
+ mock_client._ensure_bqstorage_client.return_value = mock_bqstorage_client
133
+
134
+ connection = connect(
135
+ client=mock_client,
136
+ bqstorage_client=mock_bqstorage_client,
137
+ prefer_bqstorage_client=False,
138
+ )
139
+
140
+ mock_client._ensure_bqstorage_client.assert_not_called()
141
+ self.assertIsInstance(connection, Connection)
142
+ self.assertIs(connection._client, mock_client)
143
+ self.assertIs(connection._bqstorage_client, None)
144
+
125
145
  def test_raises_error_if_closed(self):
126
146
  from google.cloud.bigquery.dbapi.exceptions import ProgrammingError
127
147