sqlalchemy-bigquery 1.18.0__tar.gz → 1.19.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (72) hide show
  1. {sqlalchemy_bigquery-1.18.0/sqlalchemy_bigquery.egg-info → sqlalchemy_bigquery-1.19.0}/PKG-INFO +20 -17
  2. {sqlalchemy_bigquery-1.18.0 → sqlalchemy_bigquery-1.19.0}/README.rst +8 -4
  3. {sqlalchemy_bigquery-1.18.0 → sqlalchemy_bigquery-1.19.0}/pyproject.toml +6 -0
  4. {sqlalchemy_bigquery-1.18.0 → sqlalchemy_bigquery-1.19.0}/setup.py +5 -6
  5. {sqlalchemy_bigquery-1.18.0 → sqlalchemy_bigquery-1.19.0}/sqlalchemy_bigquery/__init__.py +0 -16
  6. {sqlalchemy_bigquery-1.18.0 → sqlalchemy_bigquery-1.19.0}/sqlalchemy_bigquery/_helpers.py +45 -1
  7. {sqlalchemy_bigquery-1.18.0 → sqlalchemy_bigquery-1.19.0}/sqlalchemy_bigquery/_struct.py +5 -6
  8. {sqlalchemy_bigquery-1.18.0 → sqlalchemy_bigquery-1.19.0}/sqlalchemy_bigquery/base.py +291 -28
  9. {sqlalchemy_bigquery-1.18.0 → sqlalchemy_bigquery-1.19.0}/sqlalchemy_bigquery/version.py +1 -1
  10. {sqlalchemy_bigquery-1.18.0 → sqlalchemy_bigquery-1.19.0/sqlalchemy_bigquery.egg-info}/PKG-INFO +20 -17
  11. {sqlalchemy_bigquery-1.18.0 → sqlalchemy_bigquery-1.19.0}/sqlalchemy_bigquery.egg-info/SOURCES.txt +2 -0
  12. {sqlalchemy_bigquery-1.18.0 → sqlalchemy_bigquery-1.19.0}/sqlalchemy_bigquery.egg-info/requires.txt +10 -10
  13. {sqlalchemy_bigquery-1.18.0 → sqlalchemy_bigquery-1.19.0}/tests/system/test__struct.py +2 -8
  14. {sqlalchemy_bigquery-1.18.0 → sqlalchemy_bigquery-1.19.0}/tests/system/test_helpers.py +15 -0
  15. {sqlalchemy_bigquery-1.18.0 → sqlalchemy_bigquery-1.19.0}/tests/system/test_sqlalchemy_bigquery.py +61 -31
  16. {sqlalchemy_bigquery-1.18.0 → sqlalchemy_bigquery-1.19.0}/tests/unit/test__struct.py +61 -14
  17. sqlalchemy_bigquery-1.19.0/tests/unit/test_check_compiler_safety.py +658 -0
  18. {sqlalchemy_bigquery-1.18.0 → sqlalchemy_bigquery-1.19.0}/tests/unit/test_compiler.py +362 -0
  19. {sqlalchemy_bigquery-1.18.0 → sqlalchemy_bigquery-1.19.0}/tests/unit/test_engine.py +89 -0
  20. sqlalchemy_bigquery-1.19.0/tests/unit/test_like_reescape.py +181 -0
  21. {sqlalchemy_bigquery-1.18.0 → sqlalchemy_bigquery-1.19.0}/tests/unit/test_sqlalchemy_bigquery.py +140 -0
  22. sqlalchemy_bigquery-1.19.0/tests/unit/test_universe_domain.py +221 -0
  23. sqlalchemy_bigquery-1.18.0/tests/unit/test_like_reescape.py +0 -47
  24. {sqlalchemy_bigquery-1.18.0 → sqlalchemy_bigquery-1.19.0}/AUTHORS +0 -0
  25. {sqlalchemy_bigquery-1.18.0 → sqlalchemy_bigquery-1.19.0}/LICENSE +0 -0
  26. {sqlalchemy_bigquery-1.18.0 → sqlalchemy_bigquery-1.19.0}/MANIFEST.in +0 -0
  27. {sqlalchemy_bigquery-1.18.0 → sqlalchemy_bigquery-1.19.0}/setup.cfg +0 -0
  28. {sqlalchemy_bigquery-1.18.0 → sqlalchemy_bigquery-1.19.0}/sqlalchemy_bigquery/_types.py +0 -0
  29. {sqlalchemy_bigquery-1.18.0 → sqlalchemy_bigquery-1.19.0}/sqlalchemy_bigquery/geography.py +0 -0
  30. {sqlalchemy_bigquery-1.18.0 → sqlalchemy_bigquery-1.19.0}/sqlalchemy_bigquery/parse_url.py +0 -0
  31. {sqlalchemy_bigquery-1.18.0 → sqlalchemy_bigquery-1.19.0}/sqlalchemy_bigquery/provision.py +0 -0
  32. {sqlalchemy_bigquery-1.18.0 → sqlalchemy_bigquery-1.19.0}/sqlalchemy_bigquery/requirements.py +0 -0
  33. {sqlalchemy_bigquery-1.18.0 → sqlalchemy_bigquery-1.19.0}/sqlalchemy_bigquery.egg-info/dependency_links.txt +0 -0
  34. {sqlalchemy_bigquery-1.18.0 → sqlalchemy_bigquery-1.19.0}/sqlalchemy_bigquery.egg-info/entry_points.txt +0 -0
  35. {sqlalchemy_bigquery-1.18.0 → sqlalchemy_bigquery-1.19.0}/sqlalchemy_bigquery.egg-info/top_level.txt +0 -0
  36. {sqlalchemy_bigquery-1.18.0 → sqlalchemy_bigquery-1.19.0}/tests/__init__.py +0 -0
  37. {sqlalchemy_bigquery-1.18.0 → sqlalchemy_bigquery-1.19.0}/tests/conftest.py +0 -0
  38. {sqlalchemy_bigquery-1.18.0 → sqlalchemy_bigquery-1.19.0}/tests/sqlalchemy_dialect_compliance/README.rst +0 -0
  39. {sqlalchemy_bigquery-1.18.0 → sqlalchemy_bigquery-1.19.0}/tests/sqlalchemy_dialect_compliance/conftest.py +0 -0
  40. {sqlalchemy_bigquery-1.18.0 → sqlalchemy_bigquery-1.19.0}/tests/sqlalchemy_dialect_compliance/test_dialect_compliance.py +0 -0
  41. {sqlalchemy_bigquery-1.18.0 → sqlalchemy_bigquery-1.19.0}/tests/system/__init__.py +0 -0
  42. {sqlalchemy_bigquery-1.18.0 → sqlalchemy_bigquery-1.19.0}/tests/system/conftest.py +0 -0
  43. {sqlalchemy_bigquery-1.18.0 → sqlalchemy_bigquery-1.19.0}/tests/system/data/sample.json +0 -0
  44. {sqlalchemy_bigquery-1.18.0 → sqlalchemy_bigquery-1.19.0}/tests/system/data/sample_one_row.json +0 -0
  45. {sqlalchemy_bigquery-1.18.0 → sqlalchemy_bigquery-1.19.0}/tests/system/data/schema.json +0 -0
  46. {sqlalchemy_bigquery-1.18.0 → sqlalchemy_bigquery-1.19.0}/tests/system/test_alembic.py +0 -0
  47. {sqlalchemy_bigquery-1.18.0 → sqlalchemy_bigquery-1.19.0}/tests/system/test_geography.py +0 -0
  48. {sqlalchemy_bigquery-1.18.0 → sqlalchemy_bigquery-1.19.0}/tests/system/test_sqlalchemy_bigquery_remote.py +0 -0
  49. {sqlalchemy_bigquery-1.18.0 → sqlalchemy_bigquery-1.19.0}/tests/unit/__init__.py +0 -0
  50. {sqlalchemy_bigquery-1.18.0 → sqlalchemy_bigquery-1.19.0}/tests/unit/conftest.py +0 -0
  51. {sqlalchemy_bigquery-1.18.0 → sqlalchemy_bigquery-1.19.0}/tests/unit/fauxdbi.py +0 -0
  52. {sqlalchemy_bigquery-1.18.0 → sqlalchemy_bigquery-1.19.0}/tests/unit/test__types.py +0 -0
  53. {sqlalchemy_bigquery-1.18.0 → sqlalchemy_bigquery-1.19.0}/tests/unit/test_alembic.py +0 -0
  54. {sqlalchemy_bigquery-1.18.0 → sqlalchemy_bigquery-1.19.0}/tests/unit/test_catalog_functions.py +0 -0
  55. {sqlalchemy_bigquery-1.18.0 → sqlalchemy_bigquery-1.19.0}/tests/unit/test_comments.py +0 -0
  56. {sqlalchemy_bigquery-1.18.0 → sqlalchemy_bigquery-1.19.0}/tests/unit/test_compliance.py +0 -0
  57. {sqlalchemy_bigquery-1.18.0 → sqlalchemy_bigquery-1.19.0}/tests/unit/test_dialect_types.py +0 -0
  58. {sqlalchemy_bigquery-1.18.0 → sqlalchemy_bigquery-1.19.0}/tests/unit/test_geography.py +0 -0
  59. {sqlalchemy_bigquery-1.18.0 → sqlalchemy_bigquery-1.19.0}/tests/unit/test_helpers.py +0 -0
  60. {sqlalchemy_bigquery-1.18.0 → sqlalchemy_bigquery-1.19.0}/tests/unit/test_parse_url.py +0 -0
  61. {sqlalchemy_bigquery-1.18.0 → sqlalchemy_bigquery-1.19.0}/tests/unit/test_provision.py +0 -0
  62. {sqlalchemy_bigquery-1.18.0 → sqlalchemy_bigquery-1.19.0}/tests/unit/test_select.py +0 -0
  63. {sqlalchemy_bigquery-1.18.0 → sqlalchemy_bigquery-1.19.0}/tests/unit/test_table_options.py +0 -0
  64. {sqlalchemy_bigquery-1.18.0 → sqlalchemy_bigquery-1.19.0}/tests/unit/test_version.py +0 -0
  65. {sqlalchemy_bigquery-1.18.0 → sqlalchemy_bigquery-1.19.0}/tests/unit/test_view.py +0 -0
  66. {sqlalchemy_bigquery-1.18.0 → sqlalchemy_bigquery-1.19.0}/third_party/sqlalchemy_bigquery_vendored/__init__.py +0 -0
  67. {sqlalchemy_bigquery-1.18.0 → sqlalchemy_bigquery-1.19.0}/third_party/sqlalchemy_bigquery_vendored/py.typed +0 -0
  68. {sqlalchemy_bigquery-1.18.0 → sqlalchemy_bigquery-1.19.0}/third_party/sqlalchemy_bigquery_vendored/sqlalchemy/AUTHORS +0 -0
  69. {sqlalchemy_bigquery-1.18.0 → sqlalchemy_bigquery-1.19.0}/third_party/sqlalchemy_bigquery_vendored/sqlalchemy/LICENSE +0 -0
  70. {sqlalchemy_bigquery-1.18.0 → sqlalchemy_bigquery-1.19.0}/third_party/sqlalchemy_bigquery_vendored/sqlalchemy/__init__.py +0 -0
  71. {sqlalchemy_bigquery-1.18.0 → sqlalchemy_bigquery-1.19.0}/third_party/sqlalchemy_bigquery_vendored/sqlalchemy/postgresql/__init__.py +0 -0
  72. {sqlalchemy_bigquery-1.18.0 → sqlalchemy_bigquery-1.19.0}/third_party/sqlalchemy_bigquery_vendored/sqlalchemy/postgresql/base.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: sqlalchemy-bigquery
3
- Version: 1.18.0
3
+ Version: 1.19.0
4
4
  Summary: SQLAlchemy dialect for BigQuery
5
5
  Home-page: https://github.com/googleapis/google-cloud-python/tree/main/packages/sqlalchemy-bigquery
6
6
  Author: The Sqlalchemy-Bigquery Authors
@@ -12,7 +12,6 @@ Classifier: Intended Audience :: Developers
12
12
  Classifier: License :: OSI Approved :: MIT License
13
13
  Classifier: Programming Language :: Python
14
14
  Classifier: Programming Language :: Python :: 3
15
- Classifier: Programming Language :: Python :: 3.10
16
15
  Classifier: Programming Language :: Python :: 3.11
17
16
  Classifier: Programming Language :: Python :: 3.12
18
17
  Classifier: Programming Language :: Python :: 3.13
@@ -21,20 +20,20 @@ Classifier: Programming Language :: Python :: 3.15
21
20
  Classifier: Operating System :: OS Independent
22
21
  Classifier: Topic :: Database :: Front-Ends
23
22
  Obsoletes: pybigquery
24
- Requires-Python: >=3.10
23
+ Requires-Python: >=3.11
25
24
  Description-Content-Type: text/x-rst
26
25
  License-File: LICENSE
27
26
  License-File: AUTHORS
28
27
  Requires-Dist: google-api-core<3.0.0,>=2.25.0
29
28
  Requires-Dist: google-auth<3.0.0,>=2.14.1
30
- Requires-Dist: google-cloud-bigquery<4.0.0,>=3.20.0
29
+ Requires-Dist: google-cloud-bigquery<4.0.0,>=3.20.1
31
30
  Requires-Dist: packaging
32
- Requires-Dist: sqlalchemy<3.0.0,>=1.4.16
31
+ Requires-Dist: sqlalchemy<3.0.0,>=1.4.41
33
32
  Provides-Extra: geography
34
33
  Requires-Dist: GeoAlchemy2; extra == "geography"
35
34
  Requires-Dist: shapely; extra == "geography"
36
35
  Provides-Extra: alembic
37
- Requires-Dist: alembic; extra == "alembic"
36
+ Requires-Dist: alembic>=1.7.7; extra == "alembic"
38
37
  Provides-Extra: tests
39
38
  Requires-Dist: packaging; extra == "tests"
40
39
  Requires-Dist: pytz; extra == "tests"
@@ -42,17 +41,17 @@ Provides-Extra: bqstorage
42
41
  Requires-Dist: google-cloud-bigquery-storage<3.0.0,>=2.29.0; extra == "bqstorage"
43
42
  Requires-Dist: grpcio<2.0.0,>=1.59.0; extra == "bqstorage"
44
43
  Requires-Dist: grpcio<2.0.0,>=1.75.1; python_version >= "3.14" and extra == "bqstorage"
45
- Requires-Dist: pyarrow>=6.0.0; extra == "bqstorage"
44
+ Requires-Dist: pyarrow>=10.0.1; extra == "bqstorage"
46
45
  Provides-Extra: all
47
- Requires-Dist: pyarrow>=6.0.0; extra == "all"
48
- Requires-Dist: GeoAlchemy2; extra == "all"
49
- Requires-Dist: alembic; extra == "all"
50
- Requires-Dist: google-cloud-bigquery-storage<3.0.0,>=2.29.0; extra == "all"
51
- Requires-Dist: grpcio<2.0.0,>=1.59.0; extra == "all"
52
- Requires-Dist: packaging; extra == "all"
53
46
  Requires-Dist: pytz; extra == "all"
47
+ Requires-Dist: alembic>=1.7.7; extra == "all"
54
48
  Requires-Dist: shapely; extra == "all"
49
+ Requires-Dist: packaging; extra == "all"
50
+ Requires-Dist: grpcio<2.0.0,>=1.59.0; extra == "all"
55
51
  Requires-Dist: grpcio<2.0.0,>=1.75.1; python_version >= "3.14" and extra == "all"
52
+ Requires-Dist: google-cloud-bigquery-storage<3.0.0,>=2.29.0; extra == "all"
53
+ Requires-Dist: pyarrow>=10.0.1; extra == "all"
54
+ Requires-Dist: GeoAlchemy2; extra == "all"
56
55
  Dynamic: author
57
56
  Dynamic: author-email
58
57
  Dynamic: classifier
@@ -121,11 +120,11 @@ dependencies.
121
120
 
122
121
  Supported Python Versions
123
122
  ^^^^^^^^^^^^^^^^^^^^^^^^^
124
- Python >= 3.10, <= 3.14
123
+ Python >= 3.11, <= 3.15
125
124
 
126
125
  Unsupported Python Versions
127
126
  ^^^^^^^^^^^^^^^^^^^^^^^^^^^
128
- Python <= 3.9
127
+ Python <= 3.10
129
128
 
130
129
 
131
130
  Mac/Linux
@@ -279,7 +278,7 @@ Note that specifying a default dataset doesn't restrict execution of queries to
279
278
  Connection String Parameters
280
279
  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
281
280
 
282
- There are many situations where you can't call ``create_engine`` directly, such as when using tools like `Flask SQLAlchemy <http://flask-sqlalchemy.pocoo.org/2.3/>`_. For situations like these, or for situations where you want the ``Client`` to have a `default_query_job_config <https://googlecloudplatform.github.io/google-cloud-python/latest/bigquery/generated/google.cloud.bigquery.client.Client.html#google.cloud.bigquery.client.Client>`_, you can pass many arguments in the query of the connection string.
281
+ There are many situations where you can't call ``create_engine`` directly, such as when using tools like `Flask SQLAlchemy <https://flask-sqlalchemy.palletsprojects.com/>`_. For situations like these, or for situations where you want the ``Client`` to have a `default_query_job_config <https://googlecloudplatform.github.io/google-cloud-python/latest/bigquery/generated/google.cloud.bigquery.client.Client.html#google.cloud.bigquery.client.Client>`_, you can pass many arguments in the query of the connection string.
283
282
 
284
283
  The ``credentials_path``, ``credentials_info``, ``credentials_base64``, ``location``, ``arraysize`` and ``list_tables_page_size`` parameters are used by this library, and the rest are used to create a `QueryJobConfig <https://googlecloudplatform.github.io/google-cloud-python/latest/bigquery/generated/google.cloud.bigquery.job.QueryJobConfig.html#google.cloud.bigquery.job.QueryJobConfig>`_
285
284
 
@@ -310,6 +309,10 @@ Here are examples of all the supported arguments. Any not present are either for
310
309
 
311
310
  In cases where you wish to include the full credentials in the connection URI you can base64 the credentials JSON file and supply the encoded string to the ``credentials_base64`` parameter.
312
311
 
312
+ .. warning::
313
+
314
+ The ``credentials_base64`` parameter puts your service account's private key in the connection string. ``sqlalchemy-bigquery`` hides the key wherever SQLAlchemy hides the password of the engine's URL, such as in ``repr(engine)``. It can't hide the connection string itself, so a configuration file, an environment variable, a log message or any other URL parsed from that string still exposes the key. Where you can, use `Application Default Credentials <https://cloud.google.com/docs/authentication/application-default-credentials>`_ instead, or pass ``credentials_path`` or ``credentials_info`` to ``create_engine()`` as shown under Authentication.
315
+
313
316
  .. code-block:: python
314
317
 
315
318
  engine = create_engine(
@@ -333,7 +336,7 @@ In cases where you wish to include the full credentials in the connection URI yo
333
336
 
334
337
  To create the base64 encoded string you can use the command line tool ``base64``, or ``openssl base64``, or ``python -m base64``.
335
338
 
336
- Alternatively, you can use an online generator like `www.base64encode.org <https://www.base64encode.org>_` to paste your credentials JSON file to be encoded.
339
+ Don't use a website to encode the file: the file contains your service account's private key.
337
340
 
338
341
 
339
342
  Supplying Your Own BigQuery Client
@@ -51,11 +51,11 @@ dependencies.
51
51
 
52
52
  Supported Python Versions
53
53
  ^^^^^^^^^^^^^^^^^^^^^^^^^
54
- Python >= 3.10, <= 3.14
54
+ Python >= 3.11, <= 3.15
55
55
 
56
56
  Unsupported Python Versions
57
57
  ^^^^^^^^^^^^^^^^^^^^^^^^^^^
58
- Python <= 3.9
58
+ Python <= 3.10
59
59
 
60
60
 
61
61
  Mac/Linux
@@ -209,7 +209,7 @@ Note that specifying a default dataset doesn't restrict execution of queries to
209
209
  Connection String Parameters
210
210
  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
211
211
 
212
- There are many situations where you can't call ``create_engine`` directly, such as when using tools like `Flask SQLAlchemy <http://flask-sqlalchemy.pocoo.org/2.3/>`_. For situations like these, or for situations where you want the ``Client`` to have a `default_query_job_config <https://googlecloudplatform.github.io/google-cloud-python/latest/bigquery/generated/google.cloud.bigquery.client.Client.html#google.cloud.bigquery.client.Client>`_, you can pass many arguments in the query of the connection string.
212
+ There are many situations where you can't call ``create_engine`` directly, such as when using tools like `Flask SQLAlchemy <https://flask-sqlalchemy.palletsprojects.com/>`_. For situations like these, or for situations where you want the ``Client`` to have a `default_query_job_config <https://googlecloudplatform.github.io/google-cloud-python/latest/bigquery/generated/google.cloud.bigquery.client.Client.html#google.cloud.bigquery.client.Client>`_, you can pass many arguments in the query of the connection string.
213
213
 
214
214
  The ``credentials_path``, ``credentials_info``, ``credentials_base64``, ``location``, ``arraysize`` and ``list_tables_page_size`` parameters are used by this library, and the rest are used to create a `QueryJobConfig <https://googlecloudplatform.github.io/google-cloud-python/latest/bigquery/generated/google.cloud.bigquery.job.QueryJobConfig.html#google.cloud.bigquery.job.QueryJobConfig>`_
215
215
 
@@ -240,6 +240,10 @@ Here are examples of all the supported arguments. Any not present are either for
240
240
 
241
241
  In cases where you wish to include the full credentials in the connection URI you can base64 the credentials JSON file and supply the encoded string to the ``credentials_base64`` parameter.
242
242
 
243
+ .. warning::
244
+
245
+ The ``credentials_base64`` parameter puts your service account's private key in the connection string. ``sqlalchemy-bigquery`` hides the key wherever SQLAlchemy hides the password of the engine's URL, such as in ``repr(engine)``. It can't hide the connection string itself, so a configuration file, an environment variable, a log message or any other URL parsed from that string still exposes the key. Where you can, use `Application Default Credentials <https://cloud.google.com/docs/authentication/application-default-credentials>`_ instead, or pass ``credentials_path`` or ``credentials_info`` to ``create_engine()`` as shown under Authentication.
246
+
243
247
  .. code-block:: python
244
248
 
245
249
  engine = create_engine(
@@ -263,7 +267,7 @@ In cases where you wish to include the full credentials in the connection URI yo
263
267
 
264
268
  To create the base64 encoded string you can use the command line tool ``base64``, or ``openssl base64``, or ``python -m base64``.
265
269
 
266
- Alternatively, you can use an online generator like `www.base64encode.org <https://www.base64encode.org>_` to paste your credentials JSON file to be encoded.
270
+ Don't use a website to encode the file: the file contains your service account's private key.
267
271
 
268
272
 
269
273
  Supplying Your Own BigQuery Client
@@ -3,3 +3,9 @@
3
3
  [build-system]
4
4
  requires = ["setuptools"]
5
5
  build-backend = "setuptools.build_meta"
6
+
7
+ [tool.ruff]
8
+ line-length = 88
9
+
10
+ [tool.ruff.lint]
11
+ select = ["I"]
@@ -49,7 +49,7 @@ def readme():
49
49
 
50
50
  extras = {
51
51
  "geography": ["GeoAlchemy2", "shapely"],
52
- "alembic": ["alembic"],
52
+ "alembic": ["alembic >= 1.7.7"],
53
53
  "tests": ["packaging", "pytz"],
54
54
  # Keep the no-op bqstorage extra for backward compatibility.
55
55
  # See: https://github.com/googleapis/python-bigquery/issues/757
@@ -63,7 +63,7 @@ extras = {
63
63
  # https://github.com/grpc/grpc/pull/15254
64
64
  "grpcio >= 1.59.0, < 2.0.0",
65
65
  "grpcio >= 1.75.1, < 2.0.0; python_version >= '3.14'",
66
- "pyarrow >= 6.0.0",
66
+ "pyarrow >= 10.0.1",
67
67
  ],
68
68
  }
69
69
 
@@ -100,7 +100,6 @@ setup(
100
100
  "License :: OSI Approved :: MIT License",
101
101
  "Programming Language :: Python",
102
102
  "Programming Language :: Python :: 3",
103
- "Programming Language :: Python :: 3.10",
104
103
  "Programming Language :: Python :: 3.11",
105
104
  "Programming Language :: Python :: 3.12",
106
105
  "Programming Language :: Python :: 3.13",
@@ -113,12 +112,12 @@ setup(
113
112
  install_requires=[
114
113
  "google-api-core >= 2.25.0, <3.0.0",
115
114
  "google-auth>=2.14.1,<3.0.0",
116
- "google-cloud-bigquery>=3.20.0,<4.0.0",
115
+ "google-cloud-bigquery>=3.20.1,<4.0.0",
117
116
  "packaging",
118
- "sqlalchemy>=1.4.16,<3.0.0",
117
+ "sqlalchemy>=1.4.41,<3.0.0",
119
118
  ],
120
119
  extras_require=extras,
121
- python_requires=">=3.10",
120
+ python_requires=">=3.11",
122
121
  tests_require=["packaging", "pytz"],
123
122
  entry_points={
124
123
  "sqlalchemy.dialects": ["bigquery = sqlalchemy_bigquery:BigQueryDialect"]
@@ -20,9 +20,6 @@
20
20
  SQLAlchemy dialect for Google BigQuery
21
21
  """
22
22
 
23
- import sys
24
- import warnings
25
-
26
23
  from ._types import (
27
24
  ARRAY,
28
25
  BIGNUMERIC,
@@ -45,19 +42,6 @@ from ._types import (
45
42
  from .base import BigQueryDialect, SafeCast, dialect, safe_cast
46
43
  from .version import __version__
47
44
 
48
- # Now that support for Python 3.7, 3.8 and 3.9 has been removed, we don't expect the
49
- # following check to succeed. The warning is only included for robustness.
50
- if sys.version_info < (3, 10): # pragma: NO COVER
51
- warnings.warn(
52
- "The python-bigquery-sqlalchemy library no longer supports Python 3.7, "
53
- "3.8 and 3.9. "
54
- f"Your Python version is {sys.version_info.major}.{sys.version_info.minor}.{sys.version_info.micro}. We "
55
- "recommend that you update soon to ensure ongoing support. For "
56
- "more details, see: [Google Cloud Client Libraries Supported Python Versions policy](https://cloud.google.com/python/docs/supported-python-versions)",
57
- FutureWarning,
58
- )
59
-
60
-
61
45
  __all__ = [
62
46
  "__version__",
63
47
  "dialect",
@@ -5,14 +5,17 @@
5
5
  # https://opensource.org/licenses/MIT.
6
6
 
7
7
  import base64
8
+ import copy
8
9
  import functools
9
10
  import json
10
11
  import re
11
- from typing import Optional
12
+ from collections.abc import Mapping
13
+ from typing import Any, Optional
12
14
 
13
15
  import google.auth
14
16
  import sqlalchemy
15
17
  from google.api_core import client_info
18
+ from google.api_core import client_options as client_options_lib
16
19
  from google.cloud import bigquery
17
20
  from google.oauth2 import service_account
18
21
 
@@ -37,6 +40,40 @@ def google_client_info(
37
40
  return client_info.ClientInfo(user_agent=user_agent)
38
41
 
39
42
 
43
+ # TODO(https://github.com/googleapis/google-cloud-python/issues/19297): Replace with
44
+ # google.api_core.client_options.normalize_client_options once available and
45
+ # minimum allowed google-api-core version exceeds that release.
46
+ def _normalize_client_options(
47
+ client_options: client_options_lib.ClientOptions | Mapping[str, Any] | None,
48
+ ) -> client_options_lib.ClientOptions | None:
49
+ """Normalize ``client_options`` to a fresh ``ClientOptions`` copy or ``None``.
50
+
51
+ Args:
52
+ client_options: Optional ``ClientOptions`` instance, ``Mapping``, or
53
+ ``None``.
54
+
55
+ Returns:
56
+ A fresh ``ClientOptions`` copy, or ``None`` if ``client_options`` is
57
+ ``None``.
58
+
59
+ Raises:
60
+ TypeError: If ``client_options`` is not a ``ClientOptions`` instance,
61
+ ``Mapping``, or ``None``.
62
+ ValueError: If ``client_options`` is a ``Mapping`` containing an
63
+ unrecognized option name.
64
+ """
65
+ if client_options is None:
66
+ return None
67
+ if isinstance(client_options, Mapping):
68
+ return client_options_lib.from_dict(client_options)
69
+ if isinstance(client_options, client_options_lib.ClientOptions):
70
+ return copy.copy(client_options)
71
+ raise TypeError(
72
+ "client_options must be a ClientOptions instance, Mapping, or None; "
73
+ f"got {type(client_options).__name__}"
74
+ )
75
+
76
+
40
77
  def create_bigquery_client(
41
78
  credentials_info: Optional[dict] = None,
42
79
  credentials_path: Optional[str] = None,
@@ -45,6 +82,7 @@ def create_bigquery_client(
45
82
  location: Optional[str] = None,
46
83
  project_id: Optional[str] = None,
47
84
  user_agent: Optional[google.api_core.client_info.ClientInfo] = None,
85
+ client_options: client_options_lib.ClientOptions | Mapping[str, Any] | None = None,
48
86
  ) -> google.cloud.bigquery.Client:
49
87
  """Construct a BigQuery client object.
50
88
 
@@ -64,6 +102,10 @@ def create_bigquery_client(
64
102
  requests. If ``None``, then default info will be used. Generally,
65
103
  you only need to set this if you're developing your own library
66
104
  or partner tool.
105
+ client_options (client_options_lib.ClientOptions | Mapping[str, Any] | None):
106
+ Client options (such as ``universe_domain`` or ``api_endpoint``)
107
+ forwarded to ``google.cloud.bigquery.Client``. If ``None``, default
108
+ client options are used.
67
109
  """
68
110
 
69
111
  default_project = None
@@ -90,6 +132,7 @@ def create_bigquery_client(
90
132
  project_id = default_project
91
133
 
92
134
  client_info = google_client_info(user_agent=user_agent)
135
+ client_options = _normalize_client_options(client_options)
93
136
 
94
137
  return bigquery.Client(
95
138
  client_info=client_info,
@@ -97,6 +140,7 @@ def create_bigquery_client(
97
140
  credentials=credentials,
98
141
  location=location,
99
142
  default_query_job_config=default_query_job_config,
143
+ client_options=client_options,
100
144
  )
101
145
 
102
146
 
@@ -91,6 +91,11 @@ class STRUCT(sqlalchemy.sql.sqltypes.Indexable, sqlalchemy.types.UserDefinedType
91
91
  subtype = self.expr.type._STRUCT_byname.get(name.lower())
92
92
  if subtype is None:
93
93
  raise KeyError(name)
94
+ # Reuse `operators.json_getitem_op` to represent STRUCT subfield
95
+ # access. `BigQueryCompiler.visit_json_getitem_op_binary` in
96
+ # `base.py` checks whether the left operand is a `STRUCT` (vs. a
97
+ # `sqlalchemy.JSON` column) and compiles STRUCT subfields as
98
+ # backtick-quoted SQL identifiers (`struct_col.`field``).
94
99
  operator = operators.json_getitem_op
95
100
  index = _field_index(self, name, operator)
96
101
  return operator, index, subtype
@@ -112,9 +117,3 @@ def _field_index(self, name, operator):
112
117
  operator=operator,
113
118
  bindparam_type=sqlalchemy.types.String(),
114
119
  )
115
-
116
-
117
- # class SQLCompiler:
118
- # def visit_json_getitem_op_binary(self, binary, operator_, **kw):
119
- # left = self.process(binary.left, **kw)
120
- # return f"{left}.{binary.right.value}"