sqlalchemy-bigquery 1.17.0__tar.gz → 1.17.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 (67) hide show
  1. {sqlalchemy_bigquery-1.17.0/sqlalchemy_bigquery.egg-info → sqlalchemy_bigquery-1.17.2}/PKG-INFO +10 -12
  2. {sqlalchemy_bigquery-1.17.0 → sqlalchemy_bigquery-1.17.2}/setup.py +4 -8
  3. {sqlalchemy_bigquery-1.17.0 → sqlalchemy_bigquery-1.17.2}/sqlalchemy_bigquery/geography.py +2 -3
  4. {sqlalchemy_bigquery-1.17.0 → sqlalchemy_bigquery-1.17.2}/sqlalchemy_bigquery/version.py +1 -1
  5. {sqlalchemy_bigquery-1.17.0 → sqlalchemy_bigquery-1.17.2/sqlalchemy_bigquery.egg-info}/PKG-INFO +10 -12
  6. {sqlalchemy_bigquery-1.17.0 → sqlalchemy_bigquery-1.17.2}/sqlalchemy_bigquery.egg-info/requires.txt +7 -13
  7. {sqlalchemy_bigquery-1.17.0 → sqlalchemy_bigquery-1.17.2}/tests/system/test_geography.py +6 -8
  8. {sqlalchemy_bigquery-1.17.0 → sqlalchemy_bigquery-1.17.2}/tests/system/test_sqlalchemy_bigquery.py +8 -6
  9. {sqlalchemy_bigquery-1.17.0 → sqlalchemy_bigquery-1.17.2}/tests/unit/test_engine.py +6 -0
  10. {sqlalchemy_bigquery-1.17.0 → sqlalchemy_bigquery-1.17.2}/tests/unit/test_geography.py +33 -5
  11. {sqlalchemy_bigquery-1.17.0 → sqlalchemy_bigquery-1.17.2}/AUTHORS +0 -0
  12. {sqlalchemy_bigquery-1.17.0 → sqlalchemy_bigquery-1.17.2}/LICENSE +0 -0
  13. {sqlalchemy_bigquery-1.17.0 → sqlalchemy_bigquery-1.17.2}/MANIFEST.in +0 -0
  14. {sqlalchemy_bigquery-1.17.0 → sqlalchemy_bigquery-1.17.2}/README.rst +0 -0
  15. {sqlalchemy_bigquery-1.17.0 → sqlalchemy_bigquery-1.17.2}/pyproject.toml +0 -0
  16. {sqlalchemy_bigquery-1.17.0 → sqlalchemy_bigquery-1.17.2}/setup.cfg +0 -0
  17. {sqlalchemy_bigquery-1.17.0 → sqlalchemy_bigquery-1.17.2}/sqlalchemy_bigquery/__init__.py +0 -0
  18. {sqlalchemy_bigquery-1.17.0 → sqlalchemy_bigquery-1.17.2}/sqlalchemy_bigquery/_helpers.py +0 -0
  19. {sqlalchemy_bigquery-1.17.0 → sqlalchemy_bigquery-1.17.2}/sqlalchemy_bigquery/_struct.py +0 -0
  20. {sqlalchemy_bigquery-1.17.0 → sqlalchemy_bigquery-1.17.2}/sqlalchemy_bigquery/_types.py +0 -0
  21. {sqlalchemy_bigquery-1.17.0 → sqlalchemy_bigquery-1.17.2}/sqlalchemy_bigquery/base.py +0 -0
  22. {sqlalchemy_bigquery-1.17.0 → sqlalchemy_bigquery-1.17.2}/sqlalchemy_bigquery/parse_url.py +0 -0
  23. {sqlalchemy_bigquery-1.17.0 → sqlalchemy_bigquery-1.17.2}/sqlalchemy_bigquery/requirements.py +0 -0
  24. {sqlalchemy_bigquery-1.17.0 → sqlalchemy_bigquery-1.17.2}/sqlalchemy_bigquery.egg-info/SOURCES.txt +0 -0
  25. {sqlalchemy_bigquery-1.17.0 → sqlalchemy_bigquery-1.17.2}/sqlalchemy_bigquery.egg-info/dependency_links.txt +0 -0
  26. {sqlalchemy_bigquery-1.17.0 → sqlalchemy_bigquery-1.17.2}/sqlalchemy_bigquery.egg-info/entry_points.txt +0 -0
  27. {sqlalchemy_bigquery-1.17.0 → sqlalchemy_bigquery-1.17.2}/sqlalchemy_bigquery.egg-info/top_level.txt +0 -0
  28. {sqlalchemy_bigquery-1.17.0 → sqlalchemy_bigquery-1.17.2}/tests/__init__.py +0 -0
  29. {sqlalchemy_bigquery-1.17.0 → sqlalchemy_bigquery-1.17.2}/tests/conftest.py +0 -0
  30. {sqlalchemy_bigquery-1.17.0 → sqlalchemy_bigquery-1.17.2}/tests/sqlalchemy_dialect_compliance/README.rst +0 -0
  31. {sqlalchemy_bigquery-1.17.0 → sqlalchemy_bigquery-1.17.2}/tests/sqlalchemy_dialect_compliance/conftest.py +0 -0
  32. {sqlalchemy_bigquery-1.17.0 → sqlalchemy_bigquery-1.17.2}/tests/sqlalchemy_dialect_compliance/test_dialect_compliance.py +0 -0
  33. {sqlalchemy_bigquery-1.17.0 → sqlalchemy_bigquery-1.17.2}/tests/system/__init__.py +0 -0
  34. {sqlalchemy_bigquery-1.17.0 → sqlalchemy_bigquery-1.17.2}/tests/system/conftest.py +0 -0
  35. {sqlalchemy_bigquery-1.17.0 → sqlalchemy_bigquery-1.17.2}/tests/system/data/sample.json +0 -0
  36. {sqlalchemy_bigquery-1.17.0 → sqlalchemy_bigquery-1.17.2}/tests/system/data/sample_one_row.json +0 -0
  37. {sqlalchemy_bigquery-1.17.0 → sqlalchemy_bigquery-1.17.2}/tests/system/data/schema.json +0 -0
  38. {sqlalchemy_bigquery-1.17.0 → sqlalchemy_bigquery-1.17.2}/tests/system/test__struct.py +0 -0
  39. {sqlalchemy_bigquery-1.17.0 → sqlalchemy_bigquery-1.17.2}/tests/system/test_alembic.py +0 -0
  40. {sqlalchemy_bigquery-1.17.0 → sqlalchemy_bigquery-1.17.2}/tests/system/test_helpers.py +0 -0
  41. {sqlalchemy_bigquery-1.17.0 → sqlalchemy_bigquery-1.17.2}/tests/system/test_sqlalchemy_bigquery_remote.py +0 -0
  42. {sqlalchemy_bigquery-1.17.0 → sqlalchemy_bigquery-1.17.2}/tests/unit/__init__.py +0 -0
  43. {sqlalchemy_bigquery-1.17.0 → sqlalchemy_bigquery-1.17.2}/tests/unit/conftest.py +0 -0
  44. {sqlalchemy_bigquery-1.17.0 → sqlalchemy_bigquery-1.17.2}/tests/unit/fauxdbi.py +0 -0
  45. {sqlalchemy_bigquery-1.17.0 → sqlalchemy_bigquery-1.17.2}/tests/unit/test__struct.py +0 -0
  46. {sqlalchemy_bigquery-1.17.0 → sqlalchemy_bigquery-1.17.2}/tests/unit/test__types.py +0 -0
  47. {sqlalchemy_bigquery-1.17.0 → sqlalchemy_bigquery-1.17.2}/tests/unit/test_alembic.py +0 -0
  48. {sqlalchemy_bigquery-1.17.0 → sqlalchemy_bigquery-1.17.2}/tests/unit/test_catalog_functions.py +0 -0
  49. {sqlalchemy_bigquery-1.17.0 → sqlalchemy_bigquery-1.17.2}/tests/unit/test_comments.py +0 -0
  50. {sqlalchemy_bigquery-1.17.0 → sqlalchemy_bigquery-1.17.2}/tests/unit/test_compiler.py +0 -0
  51. {sqlalchemy_bigquery-1.17.0 → sqlalchemy_bigquery-1.17.2}/tests/unit/test_compliance.py +0 -0
  52. {sqlalchemy_bigquery-1.17.0 → sqlalchemy_bigquery-1.17.2}/tests/unit/test_dialect_types.py +0 -0
  53. {sqlalchemy_bigquery-1.17.0 → sqlalchemy_bigquery-1.17.2}/tests/unit/test_helpers.py +0 -0
  54. {sqlalchemy_bigquery-1.17.0 → sqlalchemy_bigquery-1.17.2}/tests/unit/test_like_reescape.py +0 -0
  55. {sqlalchemy_bigquery-1.17.0 → sqlalchemy_bigquery-1.17.2}/tests/unit/test_parse_url.py +0 -0
  56. {sqlalchemy_bigquery-1.17.0 → sqlalchemy_bigquery-1.17.2}/tests/unit/test_select.py +0 -0
  57. {sqlalchemy_bigquery-1.17.0 → sqlalchemy_bigquery-1.17.2}/tests/unit/test_sqlalchemy_bigquery.py +0 -0
  58. {sqlalchemy_bigquery-1.17.0 → sqlalchemy_bigquery-1.17.2}/tests/unit/test_table_options.py +0 -0
  59. {sqlalchemy_bigquery-1.17.0 → sqlalchemy_bigquery-1.17.2}/tests/unit/test_version.py +0 -0
  60. {sqlalchemy_bigquery-1.17.0 → sqlalchemy_bigquery-1.17.2}/tests/unit/test_view.py +0 -0
  61. {sqlalchemy_bigquery-1.17.0 → sqlalchemy_bigquery-1.17.2}/third_party/sqlalchemy_bigquery_vendored/__init__.py +0 -0
  62. {sqlalchemy_bigquery-1.17.0 → sqlalchemy_bigquery-1.17.2}/third_party/sqlalchemy_bigquery_vendored/py.typed +0 -0
  63. {sqlalchemy_bigquery-1.17.0 → sqlalchemy_bigquery-1.17.2}/third_party/sqlalchemy_bigquery_vendored/sqlalchemy/AUTHORS +0 -0
  64. {sqlalchemy_bigquery-1.17.0 → sqlalchemy_bigquery-1.17.2}/third_party/sqlalchemy_bigquery_vendored/sqlalchemy/LICENSE +0 -0
  65. {sqlalchemy_bigquery-1.17.0 → sqlalchemy_bigquery-1.17.2}/third_party/sqlalchemy_bigquery_vendored/sqlalchemy/__init__.py +0 -0
  66. {sqlalchemy_bigquery-1.17.0 → sqlalchemy_bigquery-1.17.2}/third_party/sqlalchemy_bigquery_vendored/sqlalchemy/postgresql/__init__.py +0 -0
  67. {sqlalchemy_bigquery-1.17.0 → sqlalchemy_bigquery-1.17.2}/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.17.0
3
+ Version: 1.17.2
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
@@ -20,11 +20,11 @@ Classifier: Programming Language :: Python :: 3.14
20
20
  Classifier: Operating System :: OS Independent
21
21
  Classifier: Topic :: Database :: Front-Ends
22
22
  Obsoletes: pybigquery
23
- Requires-Python: >=3.10, <3.15
23
+ Requires-Python: >=3.10
24
24
  Description-Content-Type: text/x-rst
25
25
  License-File: LICENSE
26
26
  License-File: AUTHORS
27
- Requires-Dist: google-api-core!=2.0.*,!=2.1.*,!=2.2.*,!=2.3.0,<3.0.0,>=2.11.1
27
+ Requires-Dist: google-api-core<3.0.0,>=2.25.0
28
28
  Requires-Dist: google-auth<3.0.0,>=2.14.1
29
29
  Requires-Dist: google-cloud-bigquery<4.0.0,>=3.20.0
30
30
  Requires-Dist: packaging
@@ -38,22 +38,20 @@ Provides-Extra: tests
38
38
  Requires-Dist: packaging; extra == "tests"
39
39
  Requires-Dist: pytz; extra == "tests"
40
40
  Provides-Extra: bqstorage
41
- Requires-Dist: google-cloud-bigquery-storage<3.0.0,>=2.18.0; extra == "bqstorage"
42
- Requires-Dist: grpcio<2.0.0,>=1.47.0; extra == "bqstorage"
43
- Requires-Dist: grpcio<2.0.0,>=1.49.1; python_version == "3.11" and extra == "bqstorage"
41
+ Requires-Dist: google-cloud-bigquery-storage<3.0.0,>=2.29.0; extra == "bqstorage"
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
44
  Requires-Dist: pyarrow>=6.0.0; extra == "bqstorage"
46
45
  Provides-Extra: all
47
- Requires-Dist: grpcio<2.0.0,>=1.75.1; python_version >= "3.14" and extra == "all"
46
+ Requires-Dist: grpcio<2.0.0,>=1.59.0; extra == "all"
48
47
  Requires-Dist: GeoAlchemy2; extra == "all"
48
+ Requires-Dist: grpcio<2.0.0,>=1.75.1; python_version >= "3.14" and extra == "all"
49
+ Requires-Dist: shapely; extra == "all"
49
50
  Requires-Dist: packaging; extra == "all"
51
+ Requires-Dist: pyarrow>=6.0.0; extra == "all"
50
52
  Requires-Dist: pytz; extra == "all"
51
53
  Requires-Dist: alembic; extra == "all"
52
- Requires-Dist: grpcio<2.0.0,>=1.49.1; python_version == "3.11" and extra == "all"
53
- Requires-Dist: grpcio<2.0.0,>=1.47.0; extra == "all"
54
- Requires-Dist: shapely; extra == "all"
55
- Requires-Dist: google-cloud-bigquery-storage<3.0.0,>=2.18.0; extra == "all"
56
- Requires-Dist: pyarrow>=6.0.0; extra == "all"
54
+ Requires-Dist: google-cloud-bigquery-storage<3.0.0,>=2.29.0; extra == "all"
57
55
  Dynamic: author
58
56
  Dynamic: author-email
59
57
  Dynamic: classifier
@@ -54,15 +54,14 @@ extras = {
54
54
  # Keep the no-op bqstorage extra for backward compatibility.
55
55
  # See: https://github.com/googleapis/python-bigquery/issues/757
56
56
  "bqstorage": [
57
- "google-cloud-bigquery-storage >= 2.18.0, <3.0.0",
57
+ "google-cloud-bigquery-storage >= 2.29.0, <3.0.0",
58
58
  # Due to an issue in pip's dependency resolver, the `grpc` extra is not
59
59
  # installed, even though `google-cloud-bigquery-storage` specifies it
60
60
  # as `google-api-core[grpc]`. We thus need to explicitly specify it here.
61
61
  # See: https://github.com/googleapis/python-bigquery/issues/83 The
62
62
  # grpc.Channel.close() method isn't added until 1.32.0.
63
63
  # https://github.com/grpc/grpc/pull/15254
64
- "grpcio >= 1.47.0, < 2.0.0",
65
- "grpcio >= 1.49.1, < 2.0.0; python_version =='3.11'",
64
+ "grpcio >= 1.59.0, < 2.0.0",
66
65
  "grpcio >= 1.75.1, < 2.0.0; python_version >= '3.14'",
67
66
  "pyarrow >= 6.0.0",
68
67
  ],
@@ -111,17 +110,14 @@ setup(
111
110
  ],
112
111
  platforms="Posix; MacOS X; Windows",
113
112
  install_requires=[
114
- "google-api-core >= 2.11.1, <3.0.0,!=2.0.*,!=2.1.*,!=2.2.*,!=2.3.0",
115
- # NOTE: Maintainers, please do not require google-auth>=2.x.x
116
- # Until this issue is closed
117
- # https://github.com/googleapis/google-cloud-python/issues/10566
113
+ "google-api-core >= 2.25.0, <3.0.0",
118
114
  "google-auth>=2.14.1,<3.0.0",
119
115
  "google-cloud-bigquery>=3.20.0,<4.0.0",
120
116
  "packaging",
121
117
  "sqlalchemy>=1.4.16,<3.0.0",
122
118
  ],
123
119
  extras_require=extras,
124
- python_requires=">=3.10, <3.15",
120
+ python_requires=">=3.10",
125
121
  tests_require=["packaging", "pytz"],
126
122
  entry_points={
127
123
  "sqlalchemy.dialects": ["bigquery = sqlalchemy_bigquery:BigQueryDialect"]
@@ -183,9 +183,8 @@ def _fixup_st_arguments(element, compiler, **kw):
183
183
  argument_types = _argument_types.get(element.name.lower())
184
184
  if argument_types:
185
185
  for argument_type, argument in zip(argument_types, element.clauses.clauses):
186
- if isinstance(argument, BindParameter) and (
187
- argument.type is not argument_type
188
- or not isinstance(argument.type, argument_type)
186
+ if isinstance(argument, BindParameter) and not isinstance(
187
+ argument.type, argument_type
189
188
  ):
190
189
  argument.type = argument_type()
191
190
 
@@ -17,4 +17,4 @@
17
17
  # IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
18
18
  # CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
19
19
 
20
- __version__ = "1.17.0"
20
+ __version__ = "1.17.2"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: sqlalchemy-bigquery
3
- Version: 1.17.0
3
+ Version: 1.17.2
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
@@ -20,11 +20,11 @@ Classifier: Programming Language :: Python :: 3.14
20
20
  Classifier: Operating System :: OS Independent
21
21
  Classifier: Topic :: Database :: Front-Ends
22
22
  Obsoletes: pybigquery
23
- Requires-Python: >=3.10, <3.15
23
+ Requires-Python: >=3.10
24
24
  Description-Content-Type: text/x-rst
25
25
  License-File: LICENSE
26
26
  License-File: AUTHORS
27
- Requires-Dist: google-api-core!=2.0.*,!=2.1.*,!=2.2.*,!=2.3.0,<3.0.0,>=2.11.1
27
+ Requires-Dist: google-api-core<3.0.0,>=2.25.0
28
28
  Requires-Dist: google-auth<3.0.0,>=2.14.1
29
29
  Requires-Dist: google-cloud-bigquery<4.0.0,>=3.20.0
30
30
  Requires-Dist: packaging
@@ -38,22 +38,20 @@ Provides-Extra: tests
38
38
  Requires-Dist: packaging; extra == "tests"
39
39
  Requires-Dist: pytz; extra == "tests"
40
40
  Provides-Extra: bqstorage
41
- Requires-Dist: google-cloud-bigquery-storage<3.0.0,>=2.18.0; extra == "bqstorage"
42
- Requires-Dist: grpcio<2.0.0,>=1.47.0; extra == "bqstorage"
43
- Requires-Dist: grpcio<2.0.0,>=1.49.1; python_version == "3.11" and extra == "bqstorage"
41
+ Requires-Dist: google-cloud-bigquery-storage<3.0.0,>=2.29.0; extra == "bqstorage"
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
44
  Requires-Dist: pyarrow>=6.0.0; extra == "bqstorage"
46
45
  Provides-Extra: all
47
- Requires-Dist: grpcio<2.0.0,>=1.75.1; python_version >= "3.14" and extra == "all"
46
+ Requires-Dist: grpcio<2.0.0,>=1.59.0; extra == "all"
48
47
  Requires-Dist: GeoAlchemy2; extra == "all"
48
+ Requires-Dist: grpcio<2.0.0,>=1.75.1; python_version >= "3.14" and extra == "all"
49
+ Requires-Dist: shapely; extra == "all"
49
50
  Requires-Dist: packaging; extra == "all"
51
+ Requires-Dist: pyarrow>=6.0.0; extra == "all"
50
52
  Requires-Dist: pytz; extra == "all"
51
53
  Requires-Dist: alembic; extra == "all"
52
- Requires-Dist: grpcio<2.0.0,>=1.49.1; python_version == "3.11" and extra == "all"
53
- Requires-Dist: grpcio<2.0.0,>=1.47.0; extra == "all"
54
- Requires-Dist: shapely; extra == "all"
55
- Requires-Dist: google-cloud-bigquery-storage<3.0.0,>=2.18.0; extra == "all"
56
- Requires-Dist: pyarrow>=6.0.0; extra == "all"
54
+ Requires-Dist: google-cloud-bigquery-storage<3.0.0,>=2.29.0; extra == "all"
57
55
  Dynamic: author
58
56
  Dynamic: author-email
59
57
  Dynamic: classifier
@@ -1,4 +1,4 @@
1
- google-api-core!=2.0.*,!=2.1.*,!=2.2.*,!=2.3.0,<3.0.0,>=2.11.1
1
+ google-api-core<3.0.0,>=2.25.0
2
2
  google-auth<3.0.0,>=2.14.1
3
3
  google-cloud-bigquery<4.0.0,>=3.20.0
4
4
  packaging
@@ -8,29 +8,23 @@ sqlalchemy<3.0.0,>=1.4.16
8
8
  alembic
9
9
 
10
10
  [all]
11
+ grpcio<2.0.0,>=1.59.0
11
12
  GeoAlchemy2
13
+ shapely
12
14
  packaging
15
+ pyarrow>=6.0.0
13
16
  pytz
14
17
  alembic
15
- grpcio<2.0.0,>=1.47.0
16
- shapely
17
- google-cloud-bigquery-storage<3.0.0,>=2.18.0
18
- pyarrow>=6.0.0
19
-
20
- [all:python_version == "3.11"]
21
- grpcio<2.0.0,>=1.49.1
18
+ google-cloud-bigquery-storage<3.0.0,>=2.29.0
22
19
 
23
20
  [all:python_version >= "3.14"]
24
21
  grpcio<2.0.0,>=1.75.1
25
22
 
26
23
  [bqstorage]
27
- google-cloud-bigquery-storage<3.0.0,>=2.18.0
28
- grpcio<2.0.0,>=1.47.0
24
+ google-cloud-bigquery-storage<3.0.0,>=2.29.0
25
+ grpcio<2.0.0,>=1.59.0
29
26
  pyarrow>=6.0.0
30
27
 
31
- [bqstorage:python_version == "3.11"]
32
- grpcio<2.0.0,>=1.49.1
33
-
34
28
  [bqstorage:python_version >= "3.14"]
35
29
  grpcio<2.0.0,>=1.75.1
36
30
 
@@ -42,7 +42,7 @@ def test_geoalchemy2_core(bigquery_dataset):
42
42
 
43
43
  from sqlalchemy import Column, MetaData, String, Table
44
44
 
45
- from sqlalchemy_bigquery import GEOGRAPHY
45
+ from sqlalchemy_bigquery import GEOGRAPHY, WKT
46
46
 
47
47
  metadata = MetaData()
48
48
  lake_table = Table(
@@ -84,7 +84,7 @@ def test_geoalchemy2_core(bigquery_dataset):
84
84
 
85
85
  [[result]] = conn.execute(
86
86
  select(lake_table.c.name).where(
87
- func.ST_Contains(lake_table.c.geog, "POINT(4 1)")
87
+ func.ST_Contains(lake_table.c.geog, WKT("POINT(4 1)"))
88
88
  )
89
89
  )
90
90
  assert result == "Orta"
@@ -117,8 +117,6 @@ def test_geoalchemy2_core(bigquery_dataset):
117
117
 
118
118
  # and, while we're at it, that we can insert WKTs, although we
119
119
  # normally wouldn't want to.
120
- from sqlalchemy_bigquery import WKT
121
-
122
120
  conn.execute(
123
121
  lake_table.insert().values(
124
122
  name="test2",
@@ -156,7 +154,7 @@ def test_geoalchemy2_orm(bigquery_dataset):
156
154
  from sqlalchemy import Column, Integer, String
157
155
  from sqlalchemy.ext.declarative import declarative_base
158
156
 
159
- from sqlalchemy_bigquery import GEOGRAPHY
157
+ from sqlalchemy_bigquery import GEOGRAPHY, WKT
160
158
 
161
159
  Base = declarative_base()
162
160
 
@@ -220,19 +218,19 @@ def test_geoalchemy2_orm(bigquery_dataset):
220
218
 
221
219
  from sqlalchemy import func
222
220
 
223
- query = session.query(Lake).filter(func.ST_Contains(Lake.geog, "POINT(4 1)"))
221
+ query = session.query(Lake).filter(func.ST_Contains(Lake.geog, WKT("POINT(4 1)")))
224
222
 
225
223
  assert [lake.name for lake in query] == ["Orta"]
226
224
 
227
225
  query = (
228
226
  session.query(Lake)
229
- .filter(Lake.geog.ST_Intersects("LINESTRING(2 1,4 1)"))
227
+ .filter(Lake.geog.ST_Intersects(WKT("LINESTRING(2 1,4 1)")))
230
228
  .order_by(Lake.name)
231
229
  )
232
230
  assert [lake.name for lake in query] == ["Garde", "Orta"]
233
231
 
234
232
  lake = session.query(Lake).filter_by(name="Garde").one()
235
- assert session.scalar(lake.geog.ST_Intersects("LINESTRING(2 1,4 1)"))
233
+ assert session.scalar(lake.geog.ST_Intersects(WKT("LINESTRING(2 1,4 1)")))
236
234
 
237
235
  # Use Other Spatial Functions
238
236
  query = session.query(Lake.name, func.ST_Area(Lake.geog).label("area")).order_by(
@@ -481,17 +481,16 @@ def test_custom_expression(
481
481
  assert len(result) > 0
482
482
 
483
483
 
484
- @pytest.mark.skipif(
485
- SQLALCHEMY_VERSION >= packaging.version.parse("2.0"),
486
- reason="Needs to be revisited as part of ensuring full SQL 2.0 compliance.",
487
- )
488
484
  def test_compiled_query_literal_binds(
489
485
  engine, engine_using_test_dataset, table, table_using_test_dataset, query
490
486
  ):
491
487
  q = query(table)
492
488
  compiled = q.compile(engine, compile_kwargs={"literal_binds": True})
493
489
  with engine.connect() as conn:
494
- result = conn.execute(compiled).fetchall()
490
+ if hasattr(conn, "exec_driver_sql"):
491
+ result = conn.exec_driver_sql(str(compiled)).fetchall()
492
+ else:
493
+ result = conn.execute(compiled).fetchall()
495
494
  assert len(result) > 0
496
495
 
497
496
  q = query(table_using_test_dataset)
@@ -499,7 +498,10 @@ def test_compiled_query_literal_binds(
499
498
  engine_using_test_dataset, compile_kwargs={"literal_binds": True}
500
499
  )
501
500
  with engine_using_test_dataset.connect() as conn:
502
- result = conn.execute(compiled).fetchall()
501
+ if hasattr(conn, "exec_driver_sql"):
502
+ result = conn.exec_driver_sql(str(compiled)).fetchall()
503
+ else:
504
+ result = conn.execute(compiled).fetchall()
503
505
  assert len(result) > 0
504
506
 
505
507
 
@@ -70,3 +70,9 @@ def test_arraysize_querystring_takes_precedence_over_default(faux_conn, metadata
70
70
  metadata.create_all(engine)
71
71
 
72
72
  assert conn.connection.test_data["arraysize"] == arraysize
73
+
74
+
75
+ def test_dbapi_deprecated():
76
+ from sqlalchemy_bigquery.base import BigQueryDialect
77
+
78
+ assert BigQueryDialect.dbapi() is BigQueryDialect.import_dbapi()
@@ -32,7 +32,7 @@ def test_geoalchemy2_core(faux_conn, last_query):
32
32
 
33
33
  from sqlalchemy import Column, String
34
34
 
35
- from sqlalchemy_bigquery import GEOGRAPHY
35
+ from sqlalchemy_bigquery import GEOGRAPHY, WKT
36
36
 
37
37
  lake_table = setup_table(
38
38
  conn, "lake", Column("name", String), Column("geog", GEOGRAPHY)
@@ -81,7 +81,7 @@ def test_geoalchemy2_core(faux_conn, last_query):
81
81
  except Exception:
82
82
  pass # sqlite had no special functions :)
83
83
  last_query(
84
- "SELECT `lake`.`name`, ST_AsBinary(`lake`.`geog`) AS `geog` \n" "FROM `lake`"
84
+ "SELECT `lake`.`name`, ST_AsBinary(`lake`.`geog`) AS `geog` \nFROM `lake`"
85
85
  )
86
86
 
87
87
  # Spatial query
@@ -91,7 +91,7 @@ def test_geoalchemy2_core(faux_conn, last_query):
91
91
  try:
92
92
  conn.execute(
93
93
  select(lake_table.c.name).where(
94
- func.ST_Contains(lake_table.c.geog, "POINT(4 1)")
94
+ func.ST_Contains(lake_table.c.geog, WKT("POINT(4 1)"))
95
95
  )
96
96
  )
97
97
  except Exception:
@@ -99,8 +99,8 @@ def test_geoalchemy2_core(faux_conn, last_query):
99
99
  last_query(
100
100
  "SELECT `lake`.`name` \n"
101
101
  "FROM `lake` \n"
102
- "WHERE ST_Contains(`lake`.`geog`, %(ST_Contains_1:geography)s)",
103
- {"ST_Contains_1": "POINT(4 1)"},
102
+ "WHERE ST_Contains(`lake`.`geog`, ST_GeogFromText(%(ST_GeogFromText_1:STRING)s))",
103
+ {"ST_GeogFromText_1": "POINT(4 1)"},
104
104
  )
105
105
 
106
106
  try:
@@ -181,3 +181,31 @@ def test_calling_st_functions_that_dont_take_geographies(faux_conn, last_query):
181
181
  " AS `ST_GeogFromText_1`",
182
182
  dict(ST_GeogFromText_2="point(0 0)"),
183
183
  )
184
+
185
+
186
+ def test_fixup_st_arguments():
187
+ from geoalchemy2.functions import GenericFunction, ST_Area
188
+ from sqlalchemy.sql.elements import BindParameter
189
+
190
+ from sqlalchemy_bigquery.geography import GEOGRAPHY, _fixup_st_arguments
191
+
192
+ class DummyCompiler:
193
+ def visit_function(self, element, **kw):
194
+ return "func(param)"
195
+
196
+ # Case 1: argument.type is not yet GEOGRAPHY
197
+ func_element = ST_Area(BindParameter("param", "point(0 0)"))
198
+ res = _fixup_st_arguments(func_element, DummyCompiler())
199
+ assert res == "func(param)"
200
+ assert isinstance(func_element.clauses.clauses[0].type, GEOGRAPHY)
201
+
202
+ # Case 2: argument.type is ALREADY GEOGRAPHY
203
+ func_element2 = ST_Area(BindParameter("param", "point(0 0)", type_=GEOGRAPHY()))
204
+ _fixup_st_arguments(func_element2, DummyCompiler())
205
+
206
+ # Case 3: function without specified argument types
207
+ class ST_Unknown(GenericFunction):
208
+ name = "ST_Unknown"
209
+
210
+ func_element3 = ST_Unknown(BindParameter("param", "point(0 0)"))
211
+ _fixup_st_arguments(func_element3, DummyCompiler())