google-cloud-bigquery 3.42.0__tar.gz → 3.42.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.
Files changed (167) hide show
  1. {google_cloud_bigquery-3.42.0/google_cloud_bigquery.egg-info → google_cloud_bigquery-3.42.2}/PKG-INFO +2 -2
  2. {google_cloud_bigquery-3.42.0 → google_cloud_bigquery-3.42.2}/google/cloud/bigquery/__init__.py +1 -1
  3. {google_cloud_bigquery-3.42.0 → google_cloud_bigquery-3.42.2}/google/cloud/bigquery/client.py +102 -61
  4. {google_cloud_bigquery-3.42.0 → google_cloud_bigquery-3.42.2}/google/cloud/bigquery/dbapi/connection.py +1 -1
  5. {google_cloud_bigquery-3.42.0 → google_cloud_bigquery-3.42.2}/google/cloud/bigquery/magics/magics.py +1 -1
  6. {google_cloud_bigquery-3.42.0 → google_cloud_bigquery-3.42.2}/google/cloud/bigquery/retry.py +11 -2
  7. {google_cloud_bigquery-3.42.0 → google_cloud_bigquery-3.42.2}/google/cloud/bigquery/table.py +3 -1
  8. {google_cloud_bigquery-3.42.0 → google_cloud_bigquery-3.42.2}/google/cloud/bigquery/version.py +1 -1
  9. {google_cloud_bigquery-3.42.0 → google_cloud_bigquery-3.42.2/google_cloud_bigquery.egg-info}/PKG-INFO +2 -2
  10. {google_cloud_bigquery-3.42.0 → google_cloud_bigquery-3.42.2}/google_cloud_bigquery.egg-info/SOURCES.txt +1 -0
  11. {google_cloud_bigquery-3.42.0 → google_cloud_bigquery-3.42.2}/google_cloud_bigquery.egg-info/requires.txt +1 -1
  12. {google_cloud_bigquery-3.42.0 → google_cloud_bigquery-3.42.2}/pyproject.toml +1 -1
  13. {google_cloud_bigquery-3.42.0 → google_cloud_bigquery-3.42.2}/tests/system/helpers.py +27 -1
  14. {google_cloud_bigquery-3.42.0 → google_cloud_bigquery-3.42.2}/tests/system/test_client.py +43 -32
  15. {google_cloud_bigquery-3.42.0 → google_cloud_bigquery-3.42.2}/tests/system/test_magics.py +25 -21
  16. google_cloud_bigquery-3.42.2/tests/system/test_ssl_retry.py +66 -0
  17. {google_cloud_bigquery-3.42.0 → google_cloud_bigquery-3.42.2}/tests/unit/test_client.py +231 -115
  18. {google_cloud_bigquery-3.42.0 → google_cloud_bigquery-3.42.2}/tests/unit/test_dbapi_connection.py +3 -3
  19. {google_cloud_bigquery-3.42.0 → google_cloud_bigquery-3.42.2}/tests/unit/test_legacy_types.py +3 -3
  20. {google_cloud_bigquery-3.42.0 → google_cloud_bigquery-3.42.2}/tests/unit/test_magics.py +4 -6
  21. {google_cloud_bigquery-3.42.0 → google_cloud_bigquery-3.42.2}/tests/unit/test_retry.py +4 -0
  22. {google_cloud_bigquery-3.42.0 → google_cloud_bigquery-3.42.2}/tests/unit/test_table.py +83 -7
  23. {google_cloud_bigquery-3.42.0 → google_cloud_bigquery-3.42.2}/LICENSE +0 -0
  24. {google_cloud_bigquery-3.42.0 → google_cloud_bigquery-3.42.2}/MANIFEST.in +0 -0
  25. {google_cloud_bigquery-3.42.0 → google_cloud_bigquery-3.42.2}/README.rst +0 -0
  26. {google_cloud_bigquery-3.42.0 → google_cloud_bigquery-3.42.2}/google/cloud/bigquery/_helpers.py +0 -0
  27. {google_cloud_bigquery-3.42.0 → google_cloud_bigquery-3.42.2}/google/cloud/bigquery/_http.py +0 -0
  28. {google_cloud_bigquery-3.42.0 → google_cloud_bigquery-3.42.2}/google/cloud/bigquery/_job_helpers.py +0 -0
  29. {google_cloud_bigquery-3.42.0 → google_cloud_bigquery-3.42.2}/google/cloud/bigquery/_pandas_helpers.py +0 -0
  30. {google_cloud_bigquery-3.42.0 → google_cloud_bigquery-3.42.2}/google/cloud/bigquery/_pyarrow_helpers.py +0 -0
  31. {google_cloud_bigquery-3.42.0 → google_cloud_bigquery-3.42.2}/google/cloud/bigquery/_string_references.py +0 -0
  32. {google_cloud_bigquery-3.42.0 → google_cloud_bigquery-3.42.2}/google/cloud/bigquery/_tqdm_helpers.py +0 -0
  33. {google_cloud_bigquery-3.42.0 → google_cloud_bigquery-3.42.2}/google/cloud/bigquery/_versions_helpers.py +0 -0
  34. {google_cloud_bigquery-3.42.0 → google_cloud_bigquery-3.42.2}/google/cloud/bigquery/dataset.py +0 -0
  35. {google_cloud_bigquery-3.42.0 → google_cloud_bigquery-3.42.2}/google/cloud/bigquery/dbapi/__init__.py +0 -0
  36. {google_cloud_bigquery-3.42.0 → google_cloud_bigquery-3.42.2}/google/cloud/bigquery/dbapi/_helpers.py +0 -0
  37. {google_cloud_bigquery-3.42.0 → google_cloud_bigquery-3.42.2}/google/cloud/bigquery/dbapi/cursor.py +0 -0
  38. {google_cloud_bigquery-3.42.0 → google_cloud_bigquery-3.42.2}/google/cloud/bigquery/dbapi/exceptions.py +0 -0
  39. {google_cloud_bigquery-3.42.0 → google_cloud_bigquery-3.42.2}/google/cloud/bigquery/dbapi/types.py +0 -0
  40. {google_cloud_bigquery-3.42.0 → google_cloud_bigquery-3.42.2}/google/cloud/bigquery/encryption_configuration.py +0 -0
  41. {google_cloud_bigquery-3.42.0 → google_cloud_bigquery-3.42.2}/google/cloud/bigquery/enums.py +0 -0
  42. {google_cloud_bigquery-3.42.0 → google_cloud_bigquery-3.42.2}/google/cloud/bigquery/exceptions.py +0 -0
  43. {google_cloud_bigquery-3.42.0 → google_cloud_bigquery-3.42.2}/google/cloud/bigquery/external_config.py +0 -0
  44. {google_cloud_bigquery-3.42.0 → google_cloud_bigquery-3.42.2}/google/cloud/bigquery/format_options.py +0 -0
  45. {google_cloud_bigquery-3.42.0 → google_cloud_bigquery-3.42.2}/google/cloud/bigquery/iam.py +0 -0
  46. {google_cloud_bigquery-3.42.0 → google_cloud_bigquery-3.42.2}/google/cloud/bigquery/job/__init__.py +0 -0
  47. {google_cloud_bigquery-3.42.0 → google_cloud_bigquery-3.42.2}/google/cloud/bigquery/job/base.py +0 -0
  48. {google_cloud_bigquery-3.42.0 → google_cloud_bigquery-3.42.2}/google/cloud/bigquery/job/copy_.py +0 -0
  49. {google_cloud_bigquery-3.42.0 → google_cloud_bigquery-3.42.2}/google/cloud/bigquery/job/extract.py +0 -0
  50. {google_cloud_bigquery-3.42.0 → google_cloud_bigquery-3.42.2}/google/cloud/bigquery/job/load.py +0 -0
  51. {google_cloud_bigquery-3.42.0 → google_cloud_bigquery-3.42.2}/google/cloud/bigquery/job/query.py +0 -0
  52. {google_cloud_bigquery-3.42.0 → google_cloud_bigquery-3.42.2}/google/cloud/bigquery/magics/__init__.py +0 -0
  53. {google_cloud_bigquery-3.42.0 → google_cloud_bigquery-3.42.2}/google/cloud/bigquery/magics/line_arg_parser/__init__.py +0 -0
  54. {google_cloud_bigquery-3.42.0 → google_cloud_bigquery-3.42.2}/google/cloud/bigquery/magics/line_arg_parser/exceptions.py +0 -0
  55. {google_cloud_bigquery-3.42.0 → google_cloud_bigquery-3.42.2}/google/cloud/bigquery/magics/line_arg_parser/lexer.py +0 -0
  56. {google_cloud_bigquery-3.42.0 → google_cloud_bigquery-3.42.2}/google/cloud/bigquery/magics/line_arg_parser/parser.py +0 -0
  57. {google_cloud_bigquery-3.42.0 → google_cloud_bigquery-3.42.2}/google/cloud/bigquery/magics/line_arg_parser/visitors.py +0 -0
  58. {google_cloud_bigquery-3.42.0 → google_cloud_bigquery-3.42.2}/google/cloud/bigquery/model.py +0 -0
  59. {google_cloud_bigquery-3.42.0 → google_cloud_bigquery-3.42.2}/google/cloud/bigquery/opentelemetry_tracing.py +0 -0
  60. {google_cloud_bigquery-3.42.0 → google_cloud_bigquery-3.42.2}/google/cloud/bigquery/py.typed +0 -0
  61. {google_cloud_bigquery-3.42.0 → google_cloud_bigquery-3.42.2}/google/cloud/bigquery/query.py +0 -0
  62. {google_cloud_bigquery-3.42.0 → google_cloud_bigquery-3.42.2}/google/cloud/bigquery/routine/__init__.py +0 -0
  63. {google_cloud_bigquery-3.42.0 → google_cloud_bigquery-3.42.2}/google/cloud/bigquery/routine/routine.py +0 -0
  64. {google_cloud_bigquery-3.42.0 → google_cloud_bigquery-3.42.2}/google/cloud/bigquery/schema.py +0 -0
  65. {google_cloud_bigquery-3.42.0 → google_cloud_bigquery-3.42.2}/google/cloud/bigquery/standard_sql.py +0 -0
  66. {google_cloud_bigquery-3.42.0 → google_cloud_bigquery-3.42.2}/google/cloud/bigquery_v2/__init__.py +0 -0
  67. {google_cloud_bigquery-3.42.0 → google_cloud_bigquery-3.42.2}/google/cloud/bigquery_v2/types/__init__.py +0 -0
  68. {google_cloud_bigquery-3.42.0 → google_cloud_bigquery-3.42.2}/google/cloud/bigquery_v2/types/encryption_config.py +0 -0
  69. {google_cloud_bigquery-3.42.0 → google_cloud_bigquery-3.42.2}/google/cloud/bigquery_v2/types/model.py +0 -0
  70. {google_cloud_bigquery-3.42.0 → google_cloud_bigquery-3.42.2}/google/cloud/bigquery_v2/types/model_reference.py +0 -0
  71. {google_cloud_bigquery-3.42.0 → google_cloud_bigquery-3.42.2}/google/cloud/bigquery_v2/types/standard_sql.py +0 -0
  72. {google_cloud_bigquery-3.42.0 → google_cloud_bigquery-3.42.2}/google/cloud/bigquery_v2/types/table_reference.py +0 -0
  73. {google_cloud_bigquery-3.42.0 → google_cloud_bigquery-3.42.2}/google_cloud_bigquery.egg-info/dependency_links.txt +0 -0
  74. {google_cloud_bigquery-3.42.0 → google_cloud_bigquery-3.42.2}/google_cloud_bigquery.egg-info/top_level.txt +0 -0
  75. {google_cloud_bigquery-3.42.0 → google_cloud_bigquery-3.42.2}/setup.cfg +0 -0
  76. {google_cloud_bigquery-3.42.0 → google_cloud_bigquery-3.42.2}/setup.py +0 -0
  77. {google_cloud_bigquery-3.42.0 → google_cloud_bigquery-3.42.2}/tests/__init__.py +0 -0
  78. {google_cloud_bigquery-3.42.0 → google_cloud_bigquery-3.42.2}/tests/data/characters.json +0 -0
  79. {google_cloud_bigquery-3.42.0 → google_cloud_bigquery-3.42.2}/tests/data/characters.jsonl +0 -0
  80. {google_cloud_bigquery-3.42.0 → google_cloud_bigquery-3.42.2}/tests/data/colors.avro +0 -0
  81. {google_cloud_bigquery-3.42.0 → google_cloud_bigquery-3.42.2}/tests/data/numeric_38_12.parquet +0 -0
  82. {google_cloud_bigquery-3.42.0 → google_cloud_bigquery-3.42.2}/tests/data/people.csv +0 -0
  83. {google_cloud_bigquery-3.42.0 → google_cloud_bigquery-3.42.2}/tests/data/pico.csv +0 -0
  84. {google_cloud_bigquery-3.42.0 → google_cloud_bigquery-3.42.2}/tests/data/pico_schema.json +0 -0
  85. {google_cloud_bigquery-3.42.0 → google_cloud_bigquery-3.42.2}/tests/data/scalars.csv +0 -0
  86. {google_cloud_bigquery-3.42.0 → google_cloud_bigquery-3.42.2}/tests/data/scalars.jsonl +0 -0
  87. {google_cloud_bigquery-3.42.0 → google_cloud_bigquery-3.42.2}/tests/data/scalars_extreme.jsonl +0 -0
  88. {google_cloud_bigquery-3.42.0 → google_cloud_bigquery-3.42.2}/tests/data/scalars_schema.json +0 -0
  89. {google_cloud_bigquery-3.42.0 → google_cloud_bigquery-3.42.2}/tests/data/scalars_schema_csv.json +0 -0
  90. {google_cloud_bigquery-3.42.0 → google_cloud_bigquery-3.42.2}/tests/data/schema.json +0 -0
  91. {google_cloud_bigquery-3.42.0 → google_cloud_bigquery-3.42.2}/tests/scrub_datasets.py +0 -0
  92. {google_cloud_bigquery-3.42.0 → google_cloud_bigquery-3.42.2}/tests/system/__init__.py +0 -0
  93. {google_cloud_bigquery-3.42.0 → google_cloud_bigquery-3.42.2}/tests/system/conftest.py +0 -0
  94. {google_cloud_bigquery-3.42.0 → google_cloud_bigquery-3.42.2}/tests/system/test_arrow.py +0 -0
  95. {google_cloud_bigquery-3.42.0 → google_cloud_bigquery-3.42.2}/tests/system/test_job_retry.py +0 -0
  96. {google_cloud_bigquery-3.42.0 → google_cloud_bigquery-3.42.2}/tests/system/test_list_rows.py +0 -0
  97. {google_cloud_bigquery-3.42.0 → google_cloud_bigquery-3.42.2}/tests/system/test_pandas.py +0 -0
  98. {google_cloud_bigquery-3.42.0 → google_cloud_bigquery-3.42.2}/tests/system/test_query.py +0 -0
  99. {google_cloud_bigquery-3.42.0 → google_cloud_bigquery-3.42.2}/tests/system/test_structs.py +0 -0
  100. {google_cloud_bigquery-3.42.0 → google_cloud_bigquery-3.42.2}/tests/unit/__init__.py +0 -0
  101. {google_cloud_bigquery-3.42.0 → google_cloud_bigquery-3.42.2}/tests/unit/_helpers/__init__.py +0 -0
  102. {google_cloud_bigquery-3.42.0 → google_cloud_bigquery-3.42.2}/tests/unit/_helpers/test_cell_data_parser.py +0 -0
  103. {google_cloud_bigquery-3.42.0 → google_cloud_bigquery-3.42.2}/tests/unit/_helpers/test_data_frame_cell_data_parser.py +0 -0
  104. {google_cloud_bigquery-3.42.0 → google_cloud_bigquery-3.42.2}/tests/unit/_helpers/test_scalar_query_param_parser.py +0 -0
  105. {google_cloud_bigquery-3.42.0 → google_cloud_bigquery-3.42.2}/tests/unit/conftest.py +0 -0
  106. {google_cloud_bigquery-3.42.0 → google_cloud_bigquery-3.42.2}/tests/unit/helpers.py +0 -0
  107. {google_cloud_bigquery-3.42.0 → google_cloud_bigquery-3.42.2}/tests/unit/job/__init__.py +0 -0
  108. {google_cloud_bigquery-3.42.0 → google_cloud_bigquery-3.42.2}/tests/unit/job/helpers.py +0 -0
  109. {google_cloud_bigquery-3.42.0 → google_cloud_bigquery-3.42.2}/tests/unit/job/test_async_job_retry.py +0 -0
  110. {google_cloud_bigquery-3.42.0 → google_cloud_bigquery-3.42.2}/tests/unit/job/test_base.py +0 -0
  111. {google_cloud_bigquery-3.42.0 → google_cloud_bigquery-3.42.2}/tests/unit/job/test_copy.py +0 -0
  112. {google_cloud_bigquery-3.42.0 → google_cloud_bigquery-3.42.2}/tests/unit/job/test_extract.py +0 -0
  113. {google_cloud_bigquery-3.42.0 → google_cloud_bigquery-3.42.2}/tests/unit/job/test_load.py +0 -0
  114. {google_cloud_bigquery-3.42.0 → google_cloud_bigquery-3.42.2}/tests/unit/job/test_load_config.py +0 -0
  115. {google_cloud_bigquery-3.42.0 → google_cloud_bigquery-3.42.2}/tests/unit/job/test_query.py +0 -0
  116. {google_cloud_bigquery-3.42.0 → google_cloud_bigquery-3.42.2}/tests/unit/job/test_query_config.py +0 -0
  117. {google_cloud_bigquery-3.42.0 → google_cloud_bigquery-3.42.2}/tests/unit/job/test_query_job_retry.py +0 -0
  118. {google_cloud_bigquery-3.42.0 → google_cloud_bigquery-3.42.2}/tests/unit/job/test_query_pandas.py +0 -0
  119. {google_cloud_bigquery-3.42.0 → google_cloud_bigquery-3.42.2}/tests/unit/job/test_query_stats.py +0 -0
  120. {google_cloud_bigquery-3.42.0 → google_cloud_bigquery-3.42.2}/tests/unit/line_arg_parser/__init__.py +0 -0
  121. {google_cloud_bigquery-3.42.0 → google_cloud_bigquery-3.42.2}/tests/unit/line_arg_parser/test_lexer.py +0 -0
  122. {google_cloud_bigquery-3.42.0 → google_cloud_bigquery-3.42.2}/tests/unit/line_arg_parser/test_parser.py +0 -0
  123. {google_cloud_bigquery-3.42.0 → google_cloud_bigquery-3.42.2}/tests/unit/line_arg_parser/test_visitors.py +0 -0
  124. {google_cloud_bigquery-3.42.0 → google_cloud_bigquery-3.42.2}/tests/unit/model/__init__.py +0 -0
  125. {google_cloud_bigquery-3.42.0 → google_cloud_bigquery-3.42.2}/tests/unit/model/test_model.py +0 -0
  126. {google_cloud_bigquery-3.42.0 → google_cloud_bigquery-3.42.2}/tests/unit/model/test_model_reference.py +0 -0
  127. {google_cloud_bigquery-3.42.0 → google_cloud_bigquery-3.42.2}/tests/unit/routine/__init__.py +0 -0
  128. {google_cloud_bigquery-3.42.0 → google_cloud_bigquery-3.42.2}/tests/unit/routine/test_external_runtime_options.py +0 -0
  129. {google_cloud_bigquery-3.42.0 → google_cloud_bigquery-3.42.2}/tests/unit/routine/test_remote_function_options.py +0 -0
  130. {google_cloud_bigquery-3.42.0 → google_cloud_bigquery-3.42.2}/tests/unit/routine/test_routine.py +0 -0
  131. {google_cloud_bigquery-3.42.0 → google_cloud_bigquery-3.42.2}/tests/unit/routine/test_routine_argument.py +0 -0
  132. {google_cloud_bigquery-3.42.0 → google_cloud_bigquery-3.42.2}/tests/unit/routine/test_routine_reference.py +0 -0
  133. {google_cloud_bigquery-3.42.0 → google_cloud_bigquery-3.42.2}/tests/unit/test__helpers.py +0 -0
  134. {google_cloud_bigquery-3.42.0 → google_cloud_bigquery-3.42.2}/tests/unit/test__http.py +0 -0
  135. {google_cloud_bigquery-3.42.0 → google_cloud_bigquery-3.42.2}/tests/unit/test__job_helpers.py +0 -0
  136. {google_cloud_bigquery-3.42.0 → google_cloud_bigquery-3.42.2}/tests/unit/test__job_helpers_retry.py +0 -0
  137. {google_cloud_bigquery-3.42.0 → google_cloud_bigquery-3.42.2}/tests/unit/test__pandas_helpers.py +0 -0
  138. {google_cloud_bigquery-3.42.0 → google_cloud_bigquery-3.42.2}/tests/unit/test__pyarrow_helpers.py +0 -0
  139. {google_cloud_bigquery-3.42.0 → google_cloud_bigquery-3.42.2}/tests/unit/test__versions_helpers.py +0 -0
  140. {google_cloud_bigquery-3.42.0 → google_cloud_bigquery-3.42.2}/tests/unit/test_client_bigframes.py +0 -0
  141. {google_cloud_bigquery-3.42.0 → google_cloud_bigquery-3.42.2}/tests/unit/test_client_resumable_media_upload.py +0 -0
  142. {google_cloud_bigquery-3.42.0 → google_cloud_bigquery-3.42.2}/tests/unit/test_client_retry.py +0 -0
  143. {google_cloud_bigquery-3.42.0 → google_cloud_bigquery-3.42.2}/tests/unit/test_create_dataset.py +0 -0
  144. {google_cloud_bigquery-3.42.0 → google_cloud_bigquery-3.42.2}/tests/unit/test_dataset.py +0 -0
  145. {google_cloud_bigquery-3.42.0 → google_cloud_bigquery-3.42.2}/tests/unit/test_dbapi__helpers.py +0 -0
  146. {google_cloud_bigquery-3.42.0 → google_cloud_bigquery-3.42.2}/tests/unit/test_dbapi_cursor.py +0 -0
  147. {google_cloud_bigquery-3.42.0 → google_cloud_bigquery-3.42.2}/tests/unit/test_dbapi_types.py +0 -0
  148. {google_cloud_bigquery-3.42.0 → google_cloud_bigquery-3.42.2}/tests/unit/test_delete_dataset.py +0 -0
  149. {google_cloud_bigquery-3.42.0 → google_cloud_bigquery-3.42.2}/tests/unit/test_encryption_configuration.py +0 -0
  150. {google_cloud_bigquery-3.42.0 → google_cloud_bigquery-3.42.2}/tests/unit/test_external_config.py +0 -0
  151. {google_cloud_bigquery-3.42.0 → google_cloud_bigquery-3.42.2}/tests/unit/test_format_options.py +0 -0
  152. {google_cloud_bigquery-3.42.0 → google_cloud_bigquery-3.42.2}/tests/unit/test_job_retry.py +0 -0
  153. {google_cloud_bigquery-3.42.0 → google_cloud_bigquery-3.42.2}/tests/unit/test_list_datasets.py +0 -0
  154. {google_cloud_bigquery-3.42.0 → google_cloud_bigquery-3.42.2}/tests/unit/test_list_jobs.py +0 -0
  155. {google_cloud_bigquery-3.42.0 → google_cloud_bigquery-3.42.2}/tests/unit/test_list_models.py +0 -0
  156. {google_cloud_bigquery-3.42.0 → google_cloud_bigquery-3.42.2}/tests/unit/test_list_projects.py +0 -0
  157. {google_cloud_bigquery-3.42.0 → google_cloud_bigquery-3.42.2}/tests/unit/test_list_routines.py +0 -0
  158. {google_cloud_bigquery-3.42.0 → google_cloud_bigquery-3.42.2}/tests/unit/test_list_tables.py +0 -0
  159. {google_cloud_bigquery-3.42.0 → google_cloud_bigquery-3.42.2}/tests/unit/test_opentelemetry_tracing.py +0 -0
  160. {google_cloud_bigquery-3.42.0 → google_cloud_bigquery-3.42.2}/tests/unit/test_packaging.py +0 -0
  161. {google_cloud_bigquery-3.42.0 → google_cloud_bigquery-3.42.2}/tests/unit/test_query.py +0 -0
  162. {google_cloud_bigquery-3.42.0 → google_cloud_bigquery-3.42.2}/tests/unit/test_schema.py +0 -0
  163. {google_cloud_bigquery-3.42.0 → google_cloud_bigquery-3.42.2}/tests/unit/test_signature_compatibility.py +0 -0
  164. {google_cloud_bigquery-3.42.0 → google_cloud_bigquery-3.42.2}/tests/unit/test_standard_sql_types.py +0 -0
  165. {google_cloud_bigquery-3.42.0 → google_cloud_bigquery-3.42.2}/tests/unit/test_string_references.py +0 -0
  166. {google_cloud_bigquery-3.42.0 → google_cloud_bigquery-3.42.2}/tests/unit/test_table_arrow.py +0 -0
  167. {google_cloud_bigquery-3.42.0 → google_cloud_bigquery-3.42.2}/tests/unit/test_table_pandas.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: google-cloud-bigquery
3
- Version: 3.42.0
3
+ Version: 3.42.2
4
4
  Summary: Google BigQuery API client library
5
5
  Author-email: Google LLC <googleapis-packages@google.com>
6
6
  License: Apache 2.0
@@ -19,7 +19,7 @@ Classifier: Topic :: Internet
19
19
  Requires-Python: >=3.10
20
20
  Description-Content-Type: text/x-rst
21
21
  License-File: LICENSE
22
- Requires-Dist: google-api-core[grpc]<3.0.0,>=2.11.1
22
+ Requires-Dist: google-api-core[grpc]<3.0.0,>=2.25.0
23
23
  Requires-Dist: google-auth[pyopenssl]<3.0.0,>=2.14.1
24
24
  Requires-Dist: google-cloud-core<3.0.0,>=2.4.1
25
25
  Requires-Dist: google-resumable-media<3.0.0,>=2.0.0
@@ -123,7 +123,7 @@ try:
123
123
  except ImportError:
124
124
  bigquery_magics = None
125
125
 
126
- if sys.version_info < (3, 10):
126
+ if sys.version_info < (3, 10): # pragma: NO COVER
127
127
  warnings.warn(
128
128
  "The python-bigquery library no longer supports Python <= 3.9. "
129
129
  f"Your Python version is {sys.version_info.major}.{sys.version_info.minor}.{sys.version_info.micro}. We "
@@ -14,11 +14,8 @@
14
14
 
15
15
  """Client for interacting with the Google BigQuery API."""
16
16
 
17
- from __future__ import absolute_import
18
- from __future__ import annotations
19
- from __future__ import division
17
+ from __future__ import absolute_import, annotations, division
20
18
 
21
- from collections import abc as collections_abc
22
19
  import copy
23
20
  import datetime
24
21
  import functools
@@ -30,36 +27,39 @@ import math
30
27
  import os
31
28
  import tempfile
32
29
  import typing
30
+ import uuid
31
+ import warnings
32
+ from collections import abc as collections_abc
33
33
  from typing import (
34
+ IO,
34
35
  Any,
35
36
  Callable,
36
37
  Dict,
37
- IO,
38
38
  Iterable,
39
- Mapping,
40
39
  List,
40
+ Mapping,
41
41
  Optional,
42
42
  Sequence,
43
43
  Tuple,
44
44
  Union,
45
45
  )
46
- import uuid
47
- import warnings
48
-
49
- import requests
50
-
51
- from google import resumable_media # type: ignore
52
- from google.resumable_media.requests import MultipartUpload # type: ignore
53
- from google.resumable_media.requests import ResumableUpload
54
46
 
55
47
  import google.api_core.client_options
56
48
  import google.api_core.exceptions as core_exceptions
57
- from google.api_core.iam import Policy
49
+ import google.cloud._helpers # type: ignore
50
+ import requests
51
+ from google import resumable_media # type: ignore
58
52
  from google.api_core import page_iterator
59
53
  from google.api_core import retry as retries
60
- import google.cloud._helpers # type: ignore
54
+ from google.api_core.iam import Policy
61
55
  from google.cloud import exceptions # pytype: disable=import-error
62
- from google.cloud.client import ClientWithProject # type: ignore # pytype: disable=import-error
56
+ from google.cloud.client import (
57
+ ClientWithProject, # type: ignore # pytype: disable=import-error
58
+ )
59
+ from google.resumable_media.requests import (
60
+ MultipartUpload, # type: ignore
61
+ ResumableUpload,
62
+ )
63
63
 
64
64
  try:
65
65
  from google.cloud.bigquery_storage_v1.services.big_query_read.client import (
@@ -70,29 +70,30 @@ except ImportError:
70
70
 
71
71
 
72
72
  from google.auth.credentials import Credentials
73
- from google.cloud.bigquery._http import Connection
74
- from google.cloud.bigquery import _job_helpers
75
- from google.cloud.bigquery import _pandas_helpers
76
- from google.cloud.bigquery import _versions_helpers
77
- from google.cloud.bigquery import enums
73
+ from google.cloud.bigquery import (
74
+ _job_helpers,
75
+ _pandas_helpers,
76
+ _versions_helpers,
77
+ enums,
78
+ job,
79
+ )
78
80
  from google.cloud.bigquery import exceptions as bq_exceptions
79
- from google.cloud.bigquery import job
80
- from google.cloud.bigquery._helpers import _get_sub_prop
81
- from google.cloud.bigquery._helpers import _record_field_to_json
82
- from google.cloud.bigquery._helpers import _str_or_none
83
- from google.cloud.bigquery._helpers import _verify_job_config_type
84
- from google.cloud.bigquery._helpers import _get_bigquery_host
85
- from google.cloud.bigquery._helpers import _DEFAULT_HOST
86
- from google.cloud.bigquery._helpers import _DEFAULT_HOST_TEMPLATE
87
- from google.cloud.bigquery._helpers import _DEFAULT_UNIVERSE
88
- from google.cloud.bigquery._helpers import _validate_universe
89
- from google.cloud.bigquery._helpers import _get_client_universe
90
- from google.cloud.bigquery._helpers import TimeoutType
81
+ from google.cloud.bigquery._helpers import (
82
+ _DEFAULT_HOST,
83
+ _DEFAULT_HOST_TEMPLATE,
84
+ _DEFAULT_UNIVERSE,
85
+ TimeoutType,
86
+ _get_bigquery_host,
87
+ _get_client_universe,
88
+ _get_sub_prop,
89
+ _record_field_to_json,
90
+ _str_or_none,
91
+ _validate_universe,
92
+ _verify_job_config_type,
93
+ )
94
+ from google.cloud.bigquery._http import Connection
91
95
  from google.cloud.bigquery._job_helpers import make_job_id as _make_job_id
92
- from google.cloud.bigquery.dataset import Dataset
93
- from google.cloud.bigquery.dataset import DatasetListItem
94
- from google.cloud.bigquery.dataset import DatasetReference
95
-
96
+ from google.cloud.bigquery.dataset import Dataset, DatasetListItem, DatasetReference
96
97
  from google.cloud.bigquery.enums import AutoRowIDs, DatasetView, UpdateMode
97
98
  from google.cloud.bigquery.format_options import ParquetOptions
98
99
  from google.cloud.bigquery.job import (
@@ -105,27 +106,26 @@ from google.cloud.bigquery.job import (
105
106
  QueryJob,
106
107
  QueryJobConfig,
107
108
  )
108
- from google.cloud.bigquery.model import Model
109
- from google.cloud.bigquery.model import ModelReference
110
- from google.cloud.bigquery.model import _model_arg_to_model_ref
109
+ from google.cloud.bigquery.model import Model, ModelReference, _model_arg_to_model_ref
111
110
  from google.cloud.bigquery.opentelemetry_tracing import create_span
112
111
  from google.cloud.bigquery.query import _QueryResults
113
112
  from google.cloud.bigquery.retry import (
113
+ DEFAULT_GET_JOB_TIMEOUT,
114
114
  DEFAULT_JOB_RETRY,
115
115
  DEFAULT_RETRY,
116
116
  DEFAULT_TIMEOUT,
117
- DEFAULT_GET_JOB_TIMEOUT,
118
117
  POLLING_DEFAULT_VALUE,
119
118
  )
120
- from google.cloud.bigquery.routine import Routine
121
- from google.cloud.bigquery.routine import RoutineReference
119
+ from google.cloud.bigquery.routine import Routine, RoutineReference
122
120
  from google.cloud.bigquery.schema import SchemaField
123
- from google.cloud.bigquery.table import _table_arg_to_table
124
- from google.cloud.bigquery.table import _table_arg_to_table_ref
125
- from google.cloud.bigquery.table import Table
126
- from google.cloud.bigquery.table import TableListItem
127
- from google.cloud.bigquery.table import TableReference
128
- from google.cloud.bigquery.table import RowIterator
121
+ from google.cloud.bigquery.table import (
122
+ RowIterator,
123
+ Table,
124
+ TableListItem,
125
+ TableReference,
126
+ _table_arg_to_table,
127
+ _table_arg_to_table_ref,
128
+ )
129
129
 
130
130
  pyarrow = _versions_helpers.PYARROW_VERSIONS.try_import()
131
131
  pandas = (
@@ -621,11 +621,45 @@ class Client(ClientWithProject):
621
621
  )
622
622
  return None
623
623
 
624
- if bqstorage_client is None: # pragma: NO COVER
624
+ # Import here since it should be installed if the BQ Storage client is
625
+ # also installed.
626
+ import google.api_core.gapic_v1.client_info
627
+
628
+ try:
629
+ import pandas_gbq # type: ignore
630
+ except ImportError:
631
+ pandas_gbq = None # type: ignore
632
+
633
+ if pandas_gbq is None:
634
+ user_agent = "pandas-gbq/0.0.0"
635
+ else:
636
+ user_agent = f"pandas-gbq/{pandas_gbq.__version__}"
637
+
638
+ if client_info is None:
639
+ amended_client_info = google.api_core.gapic_v1.client_info.ClientInfo(
640
+ user_agent=user_agent,
641
+ )
642
+ else:
643
+ if client_info.user_agent is None:
644
+ amended_user_agent = user_agent
645
+ else:
646
+ amended_user_agent = client_info.user_agent + " " + user_agent
647
+
648
+ amended_client_info = google.api_core.gapic_v1.client_info.ClientInfo(
649
+ python_version=client_info.python_version,
650
+ grpc_version=client_info.grpc_version,
651
+ api_core_version=client_info.api_core_version,
652
+ gapic_version=client_info.gapic_version,
653
+ user_agent=amended_user_agent,
654
+ rest_version=client_info.rest_version,
655
+ protobuf_runtime_version=client_info.protobuf_runtime_version,
656
+ )
657
+
658
+ if bqstorage_client is None:
625
659
  bqstorage_client = bigquery_storage.BigQueryReadClient(
626
660
  credentials=self._credentials,
627
661
  client_options=client_options,
628
- client_info=client_info, # type: ignore # (None is also accepted)
662
+ client_info=amended_client_info,
629
663
  )
630
664
 
631
665
  return bqstorage_client
@@ -4012,15 +4046,22 @@ class Client(ClientWithProject):
4012
4046
  path = "%s/insertAll" % table.path
4013
4047
  # We can always retry, because every row has an insert ID.
4014
4048
  span_attributes = {"path": path}
4015
- response = self._call_api(
4016
- retry,
4017
- span_name="BigQuery.insertRowsJson",
4018
- span_attributes=span_attributes,
4019
- method="POST",
4020
- path=path,
4021
- data=data,
4022
- timeout=timeout,
4023
- )
4049
+ try:
4050
+ response = self._call_api(
4051
+ retry,
4052
+ span_name="BigQuery.insertRowsJson",
4053
+ span_attributes=span_attributes,
4054
+ method="POST",
4055
+ path=path,
4056
+ data=data,
4057
+ timeout=timeout,
4058
+ )
4059
+ except requests.exceptions.SSLError as exc:
4060
+ msg = (
4061
+ "An SSL/Connection error occurred while streaming rows. This "
4062
+ "could be due to an invalid request (e.g., invalid table schema)."
4063
+ )
4064
+ raise requests.exceptions.SSLError(msg) from exc
4024
4065
  errors = []
4025
4066
 
4026
4067
  for error in response.get("insertErrors", ()):
@@ -84,7 +84,7 @@ class Connection(object):
84
84
 
85
85
  if self._owns_bqstorage_client:
86
86
  # There is no close() on the BQ Storage client itself.
87
- self._bqstorage_client._transport.grpc_channel.close()
87
+ self._bqstorage_client._transport.close()
88
88
 
89
89
  for cursor_ in self._cursors_created:
90
90
  if not cursor_._closed:
@@ -773,4 +773,4 @@ def _close_transports(client, bqstorage_client):
773
773
  """
774
774
  client.close()
775
775
  if bqstorage_client is not None:
776
- bqstorage_client._transport.grpc_channel.close()
776
+ bqstorage_client._transport.close()
@@ -40,6 +40,11 @@ _UNSTRUCTURED_RETRYABLE_TYPES = (
40
40
 
41
41
  _DEFAULT_RETRY_DEADLINE = 10.0 * 60.0 # 10 minutes
42
42
 
43
+ # Exceptions that are subclasses of types in _UNSTRUCTURED_RETRYABLE_TYPES
44
+ # but should not be retried because they typically indicate persistent
45
+ # configuration or security issues.
46
+ _UNSTRUCTURED_NON_RETRYABLE_TYPES = (requests.exceptions.SSLError,)
47
+
43
48
  # Ambiguous errors (e.g. internalError, backendError, rateLimitExceeded) retry
44
49
  # until the full `_DEFAULT_RETRY_DEADLINE`. This is because the
45
50
  # `jobs.getQueryResults` REST API translates a job failure into an HTTP error.
@@ -64,9 +69,13 @@ _DEFAULT_JOB_DEADLINE = 2.0 * (2.0 * _DEFAULT_RETRY_DEADLINE)
64
69
  def _should_retry(exc):
65
70
  """Predicate for determining when to retry.
66
71
 
67
- We retry if and only if the 'reason' is in _RETRYABLE_REASONS or is
68
- in _UNSTRUCTURED_RETRYABLE_TYPES.
72
+ We retry if the 'reason' is in _RETRYABLE_REASONS or if the exception
73
+ is an instance of one of the _UNSTRUCTURED_RETRYABLE_TYPES, unless it
74
+ is explicitly excluded by being in _UNSTRUCTURED_NON_RETRYABLE_TYPES.
69
75
  """
76
+ if isinstance(exc, _UNSTRUCTURED_NON_RETRYABLE_TYPES):
77
+ return False
78
+
70
79
  try:
71
80
  reason = exc.errors[0]["reason"]
72
81
  except (AttributeError, IndexError, TypeError, KeyError):
@@ -2353,7 +2353,9 @@ class RowIterator(HTTPIterator):
2353
2353
  progress_bar.close()
2354
2354
  finally:
2355
2355
  if owns_bqstorage_client:
2356
- bqstorage_client._transport.grpc_channel.close() # type: ignore
2356
+ # mypy: bqstorage_client is guaranteed to be not None when owns_bqstorage_client is True,
2357
+ # but mypy cannot infer this correlation. We ignore the union-attr error here.
2358
+ bqstorage_client._transport.close() # type: ignore[union-attr]
2357
2359
 
2358
2360
  if record_batches and bqstorage_client is not None:
2359
2361
  return pyarrow.Table.from_batches(record_batches)
@@ -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.42.0"
15
+ __version__ = "3.42.2"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: google-cloud-bigquery
3
- Version: 3.42.0
3
+ Version: 3.42.2
4
4
  Summary: Google BigQuery API client library
5
5
  Author-email: Google LLC <googleapis-packages@google.com>
6
6
  License: Apache 2.0
@@ -19,7 +19,7 @@ Classifier: Topic :: Internet
19
19
  Requires-Python: >=3.10
20
20
  Description-Content-Type: text/x-rst
21
21
  License-File: LICENSE
22
- Requires-Dist: google-api-core[grpc]<3.0.0,>=2.11.1
22
+ Requires-Dist: google-api-core[grpc]<3.0.0,>=2.25.0
23
23
  Requires-Dist: google-auth[pyopenssl]<3.0.0,>=2.14.1
24
24
  Requires-Dist: google-cloud-core<3.0.0,>=2.4.1
25
25
  Requires-Dist: google-resumable-media<3.0.0,>=2.0.0
@@ -88,6 +88,7 @@ tests/system/test_list_rows.py
88
88
  tests/system/test_magics.py
89
89
  tests/system/test_pandas.py
90
90
  tests/system/test_query.py
91
+ tests/system/test_ssl_retry.py
91
92
  tests/system/test_structs.py
92
93
  tests/unit/__init__.py
93
94
  tests/unit/conftest.py
@@ -1,4 +1,4 @@
1
- google-api-core[grpc]<3.0.0,>=2.11.1
1
+ google-api-core[grpc]<3.0.0,>=2.25.0
2
2
  google-auth[pyopenssl]<3.0.0,>=2.14.1
3
3
  google-cloud-core<3.0.0,>=2.4.1
4
4
  google-resumable-media<3.0.0,>=2.0.0
@@ -41,7 +41,7 @@ classifiers = [
41
41
  "Topic :: Internet",
42
42
  ]
43
43
  dependencies = [
44
- "google-api-core[grpc] >= 2.11.1, < 3.0.0",
44
+ "google-api-core[grpc] >= 2.25.0, < 3.0.0",
45
45
  "google-auth[pyopenssl] >= 2.14.1, < 3.0.0",
46
46
  "google-cloud-core >= 2.4.1, < 3.0.0",
47
47
  "google-resumable-media >= 2.0.0, < 3.0.0",
@@ -12,6 +12,7 @@
12
12
  # See the License for the specific language governing permissions and
13
13
  # limitations under the License.
14
14
 
15
+ import contextlib
15
16
  import datetime
16
17
  import decimal
17
18
  import uuid
@@ -21,7 +22,6 @@ import test_utils.retry
21
22
 
22
23
  from google.cloud._helpers import UTC
23
24
 
24
-
25
25
  _naive = datetime.datetime(2016, 12, 5, 12, 41, 9)
26
26
  _naive_microseconds = datetime.datetime(2016, 12, 5, 12, 41, 9, 250000)
27
27
  _stamp = "%s %s" % (_naive.date().isoformat(), _naive.time().isoformat())
@@ -104,3 +104,29 @@ retry_403 = test_utils.retry.RetryErrors(
104
104
  google.api_core.exceptions.Forbidden,
105
105
  error_predicate=_rate_limit_exceeded,
106
106
  )
107
+
108
+
109
+ @contextlib.contextmanager
110
+ def patch_tracked_requests():
111
+ """Context manager to patch google-auth requests and track/close their HTTP sessions.
112
+
113
+ This prevents socket leaks in system tests that use Workload Identity or metadata server auth.
114
+ """
115
+ import google.auth.transport.requests
116
+
117
+ original_init = google.auth.transport.requests.Request.__init__
118
+ tracked_requests = []
119
+
120
+ def patched_init(self, session=None):
121
+ original_init(self, session=session)
122
+ if session is None:
123
+ tracked_requests.append(self)
124
+
125
+ google.auth.transport.requests.Request.__init__ = patched_init
126
+ try:
127
+ yield tracked_requests
128
+ finally:
129
+ google.auth.transport.requests.Request.__init__ = original_init
130
+ for req in tracked_requests:
131
+ if hasattr(req, "session") and req.session is not None:
132
+ req.session.close()
@@ -58,7 +58,6 @@ from test_utils.system import unique_resource_id
58
58
 
59
59
  from . import helpers
60
60
 
61
-
62
61
  JOB_TIMEOUT = 120 # 2 minutes
63
62
  DATA_PATH = pathlib.Path(__file__).parent.parent / "data"
64
63
 
@@ -234,23 +233,29 @@ class TestBigQuery(unittest.TestCase):
234
233
 
235
234
  def test_close_releases_open_sockets(self):
236
235
  current_process = psutil.Process()
237
- conn_count_start = len(current_process.net_connections())
236
+ conn_start = current_process.net_connections()
237
+ conn_count_start = len(conn_start)
238
+
239
+ with helpers.patch_tracked_requests():
240
+ client = Config.CLIENT
241
+ client.query(
242
+ """
243
+ SELECT
244
+ source_year AS year, COUNT(is_male) AS birth_count
245
+ FROM `bigquery-public-data.samples.natality`
246
+ GROUP BY year
247
+ ORDER BY year DESC
248
+ LIMIT 15
249
+ """
250
+ )
238
251
 
239
- client = Config.CLIENT
240
- client.query(
241
- """
242
- SELECT
243
- source_year AS year, COUNT(is_male) AS birth_count
244
- FROM `bigquery-public-data.samples.natality`
245
- GROUP BY year
246
- ORDER BY year DESC
247
- LIMIT 15
248
- """
249
- )
252
+ client.close()
250
253
 
251
- client.close()
254
+ import gc
252
255
 
253
- conn_count_end = len(current_process.net_connections())
256
+ gc.collect()
257
+ conn_end = current_process.net_connections()
258
+ conn_count_end = len(conn_end)
254
259
  self.assertLessEqual(conn_count_end, conn_count_start)
255
260
 
256
261
  def test_create_dataset(self):
@@ -2174,25 +2179,31 @@ class TestBigQuery(unittest.TestCase):
2174
2179
  def test_dbapi_connection_does_not_leak_sockets(self):
2175
2180
  pytest.importorskip("google.cloud.bigquery_storage")
2176
2181
  current_process = psutil.Process()
2177
- conn_count_start = len(current_process.net_connections())
2178
-
2179
- # Provide no explicit clients, so that the connection will create and own them.
2180
- connection = dbapi.connect()
2181
- cursor = connection.cursor()
2182
-
2183
- cursor.execute(
2182
+ conn_start = current_process.net_connections()
2183
+ conn_count_start = len(conn_start)
2184
+
2185
+ with helpers.patch_tracked_requests():
2186
+ # Provide no explicit clients, so that the connection will create and own them.
2187
+ connection = dbapi.connect()
2188
+ cursor = connection.cursor()
2189
+
2190
+ cursor.execute(
2191
+ """
2192
+ SELECT id, `by`, timestamp
2193
+ FROM `bigquery-public-data.hacker_news.full`
2194
+ ORDER BY `id` ASC
2195
+ LIMIT 100000
2184
2196
  """
2185
- SELECT id, `by`, timestamp
2186
- FROM `bigquery-public-data.hacker_news.full`
2187
- ORDER BY `id` ASC
2188
- LIMIT 100000
2189
- """
2190
- )
2191
- rows = cursor.fetchall()
2192
- self.assertEqual(len(rows), 100000)
2197
+ )
2198
+ rows = cursor.fetchall()
2199
+ self.assertEqual(len(rows), 100000)
2200
+
2201
+ connection.close()
2202
+ import gc
2193
2203
 
2194
- connection.close()
2195
- conn_count_end = len(current_process.net_connections())
2204
+ gc.collect()
2205
+ conn_end = current_process.net_connections()
2206
+ conn_count_end = len(conn_end)
2196
2207
  self.assertLessEqual(conn_count_end, conn_count_start)
2197
2208
 
2198
2209
  def _load_table_for_dml(self, rows, dataset_id, table_id):
@@ -19,6 +19,7 @@ import re
19
19
  import pytest
20
20
  import psutil
21
21
 
22
+ from . import helpers
22
23
 
23
24
  IPython = pytest.importorskip("IPython")
24
25
  io = pytest.importorskip("IPython.utils.io")
@@ -48,27 +49,30 @@ def ipython_interactive(ipython):
48
49
  def test_bigquery_magic(ipython_interactive):
49
50
  ip = IPython.get_ipython()
50
51
  current_process = psutil.Process()
51
- conn_count_start = len(current_process.net_connections())
52
-
53
- # Deprecated, but should still work in google-cloud-bigquery 3.x.
54
- with pytest.warns(FutureWarning, match="bigquery_magics"):
55
- ip.extension_manager.load_extension("google.cloud.bigquery")
56
-
57
- sql = """
58
- SELECT
59
- CONCAT(
60
- 'https://stackoverflow.com/questions/',
61
- CAST(id as STRING)) as url,
62
- view_count
63
- FROM `bigquery-public-data.stackoverflow.posts_questions`
64
- WHERE tags like '%google-bigquery%'
65
- ORDER BY view_count DESC
66
- LIMIT 10
67
- """
68
- with io.capture_output() as captured:
69
- result = ip.run_cell_magic("bigquery", "--use_rest_api", sql)
70
-
71
- conn_count_end = len(current_process.net_connections())
52
+ conn_start = current_process.net_connections()
53
+ conn_count_start = len(conn_start)
54
+
55
+ with helpers.patch_tracked_requests():
56
+ # Deprecated, but should still work in google-cloud-bigquery 3.x.
57
+ with pytest.warns(FutureWarning, match="bigquery_magics"):
58
+ ip.extension_manager.load_extension("google.cloud.bigquery")
59
+
60
+ sql = """
61
+ SELECT
62
+ CONCAT(
63
+ 'https://stackoverflow.com/questions/',
64
+ CAST(id as STRING)) as url,
65
+ view_count
66
+ FROM `bigquery-public-data.stackoverflow.posts_questions`
67
+ WHERE tags like '%google-bigquery%'
68
+ ORDER BY view_count DESC
69
+ LIMIT 10
70
+ """
71
+ with io.capture_output() as captured:
72
+ result = ip.run_cell_magic("bigquery", "--use_rest_api", sql)
73
+
74
+ conn_end = current_process.net_connections()
75
+ conn_count_end = len(conn_end)
72
76
 
73
77
  lines = re.split("\n|\r", captured.stdout)
74
78
  # Removes blanks & terminal code (result of display clearing)
@@ -0,0 +1,66 @@
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
+ # https://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
+ import time
16
+ from unittest import mock
17
+
18
+ import pytest
19
+ import requests.exceptions
20
+ from google.cloud import bigquery
21
+
22
+
23
+ def test_insert_rows_json_ssl_error_no_retry(bigquery_client, dataset_id, project_id):
24
+ """
25
+ Verify that SSLError during insert_rows_json is NOT retried and
26
+ propagates a descriptive error message immediately.
27
+ """
28
+ table_id = f"{project_id}.{dataset_id}.test_ssl_retry_{int(time.time())}"
29
+ schema = [bigquery.SchemaField("name", "STRING")]
30
+ table = bigquery.Table(table_id, schema=schema)
31
+ bigquery_client.create_table(table)
32
+ try:
33
+ # We mock the api_request to simulate the GFE abruptly closing the connection
34
+ # which manifests as a requests.exceptions.SSLError.
35
+ bigquery_client._connection.api_request
36
+ call_count = 0
37
+
38
+ def mock_api_request(*args, **kwargs):
39
+ nonlocal call_count
40
+ call_count += 1
41
+ raise requests.exceptions.SSLError("EOF occurred in violation of protocol")
42
+
43
+ with mock.patch.object(
44
+ bigquery_client._connection, "api_request", side_effect=mock_api_request
45
+ ):
46
+ # Use a reasonably short deadline for the test, although it should fail on the first attempt anyway.
47
+ retry = bigquery.DEFAULT_RETRY.with_deadline(5.0)
48
+
49
+ start_time = time.time()
50
+ with pytest.raises(requests.exceptions.SSLError) as excinfo:
51
+ bigquery_client.insert_rows_json(table, [{"name": "test"}], retry=retry)
52
+ duration = time.time() - start_time
53
+
54
+ # Verification:
55
+ # 1. It should NOT have retried (total calls should be 1)
56
+ assert call_count == 1
57
+
58
+ # 2. It should have failed quickly (much less than the 5s deadline)
59
+ assert duration < 2.0
60
+
61
+ # 3. The error message should contain our descriptive wrapping
62
+ assert "invalid table schema" in str(excinfo.value)
63
+ assert "SSL/Connection error occurred" in str(excinfo.value)
64
+ finally:
65
+ # Cleanup
66
+ bigquery_client.delete_table(table_id)