sqlalchemy-bigquery 1.14.0__tar.gz → 1.15.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 (68) hide show
  1. {sqlalchemy_bigquery-1.14.0/sqlalchemy_bigquery.egg-info → sqlalchemy_bigquery-1.15.0}/PKG-INFO +25 -10
  2. {sqlalchemy_bigquery-1.14.0 → sqlalchemy_bigquery-1.15.0}/README.rst +1 -1
  3. {sqlalchemy_bigquery-1.14.0 → sqlalchemy_bigquery-1.15.0}/setup.py +2 -1
  4. {sqlalchemy_bigquery-1.14.0 → sqlalchemy_bigquery-1.15.0}/sqlalchemy_bigquery/_types.py +1 -1
  5. {sqlalchemy_bigquery-1.14.0 → sqlalchemy_bigquery-1.15.0}/sqlalchemy_bigquery/version.py +1 -1
  6. {sqlalchemy_bigquery-1.14.0 → sqlalchemy_bigquery-1.15.0/sqlalchemy_bigquery.egg-info}/PKG-INFO +25 -10
  7. {sqlalchemy_bigquery-1.14.0 → sqlalchemy_bigquery-1.15.0}/sqlalchemy_bigquery.egg-info/SOURCES.txt +1 -0
  8. sqlalchemy_bigquery-1.15.0/tests/unit/test__types.py +232 -0
  9. {sqlalchemy_bigquery-1.14.0 → sqlalchemy_bigquery-1.15.0}/AUTHORS +0 -0
  10. {sqlalchemy_bigquery-1.14.0 → sqlalchemy_bigquery-1.15.0}/LICENSE +0 -0
  11. {sqlalchemy_bigquery-1.14.0 → sqlalchemy_bigquery-1.15.0}/MANIFEST.in +0 -0
  12. {sqlalchemy_bigquery-1.14.0 → sqlalchemy_bigquery-1.15.0}/pyproject.toml +0 -0
  13. {sqlalchemy_bigquery-1.14.0 → sqlalchemy_bigquery-1.15.0}/setup.cfg +0 -0
  14. {sqlalchemy_bigquery-1.14.0 → sqlalchemy_bigquery-1.15.0}/sqlalchemy_bigquery/__init__.py +0 -0
  15. {sqlalchemy_bigquery-1.14.0 → sqlalchemy_bigquery-1.15.0}/sqlalchemy_bigquery/_helpers.py +0 -0
  16. {sqlalchemy_bigquery-1.14.0 → sqlalchemy_bigquery-1.15.0}/sqlalchemy_bigquery/_struct.py +0 -0
  17. {sqlalchemy_bigquery-1.14.0 → sqlalchemy_bigquery-1.15.0}/sqlalchemy_bigquery/_versions_helpers.py +0 -0
  18. {sqlalchemy_bigquery-1.14.0 → sqlalchemy_bigquery-1.15.0}/sqlalchemy_bigquery/base.py +0 -0
  19. {sqlalchemy_bigquery-1.14.0 → sqlalchemy_bigquery-1.15.0}/sqlalchemy_bigquery/geography.py +0 -0
  20. {sqlalchemy_bigquery-1.14.0 → sqlalchemy_bigquery-1.15.0}/sqlalchemy_bigquery/parse_url.py +0 -0
  21. {sqlalchemy_bigquery-1.14.0 → sqlalchemy_bigquery-1.15.0}/sqlalchemy_bigquery/requirements.py +0 -0
  22. {sqlalchemy_bigquery-1.14.0 → sqlalchemy_bigquery-1.15.0}/sqlalchemy_bigquery.egg-info/dependency_links.txt +0 -0
  23. {sqlalchemy_bigquery-1.14.0 → sqlalchemy_bigquery-1.15.0}/sqlalchemy_bigquery.egg-info/entry_points.txt +0 -0
  24. {sqlalchemy_bigquery-1.14.0 → sqlalchemy_bigquery-1.15.0}/sqlalchemy_bigquery.egg-info/requires.txt +5 -5
  25. {sqlalchemy_bigquery-1.14.0 → sqlalchemy_bigquery-1.15.0}/sqlalchemy_bigquery.egg-info/top_level.txt +0 -0
  26. {sqlalchemy_bigquery-1.14.0 → sqlalchemy_bigquery-1.15.0}/tests/__init__.py +0 -0
  27. {sqlalchemy_bigquery-1.14.0 → sqlalchemy_bigquery-1.15.0}/tests/conftest.py +0 -0
  28. {sqlalchemy_bigquery-1.14.0 → sqlalchemy_bigquery-1.15.0}/tests/sqlalchemy_dialect_compliance/README.rst +0 -0
  29. {sqlalchemy_bigquery-1.14.0 → sqlalchemy_bigquery-1.15.0}/tests/sqlalchemy_dialect_compliance/conftest.py +0 -0
  30. {sqlalchemy_bigquery-1.14.0 → sqlalchemy_bigquery-1.15.0}/tests/sqlalchemy_dialect_compliance/test_dialect_compliance.py +0 -0
  31. {sqlalchemy_bigquery-1.14.0 → sqlalchemy_bigquery-1.15.0}/tests/system/__init__.py +0 -0
  32. {sqlalchemy_bigquery-1.14.0 → sqlalchemy_bigquery-1.15.0}/tests/system/conftest.py +0 -0
  33. {sqlalchemy_bigquery-1.14.0 → sqlalchemy_bigquery-1.15.0}/tests/system/data/sample.json +0 -0
  34. {sqlalchemy_bigquery-1.14.0 → sqlalchemy_bigquery-1.15.0}/tests/system/data/sample_one_row.json +0 -0
  35. {sqlalchemy_bigquery-1.14.0 → sqlalchemy_bigquery-1.15.0}/tests/system/data/schema.json +0 -0
  36. {sqlalchemy_bigquery-1.14.0 → sqlalchemy_bigquery-1.15.0}/tests/system/test__struct.py +0 -0
  37. {sqlalchemy_bigquery-1.14.0 → sqlalchemy_bigquery-1.15.0}/tests/system/test_alembic.py +0 -0
  38. {sqlalchemy_bigquery-1.14.0 → sqlalchemy_bigquery-1.15.0}/tests/system/test_geography.py +0 -0
  39. {sqlalchemy_bigquery-1.14.0 → sqlalchemy_bigquery-1.15.0}/tests/system/test_helpers.py +0 -0
  40. {sqlalchemy_bigquery-1.14.0 → sqlalchemy_bigquery-1.15.0}/tests/system/test_sqlalchemy_bigquery.py +0 -0
  41. {sqlalchemy_bigquery-1.14.0 → sqlalchemy_bigquery-1.15.0}/tests/system/test_sqlalchemy_bigquery_remote.py +0 -0
  42. {sqlalchemy_bigquery-1.14.0 → sqlalchemy_bigquery-1.15.0}/tests/unit/__init__.py +0 -0
  43. {sqlalchemy_bigquery-1.14.0 → sqlalchemy_bigquery-1.15.0}/tests/unit/conftest.py +0 -0
  44. {sqlalchemy_bigquery-1.14.0 → sqlalchemy_bigquery-1.15.0}/tests/unit/fauxdbi.py +0 -0
  45. {sqlalchemy_bigquery-1.14.0 → sqlalchemy_bigquery-1.15.0}/tests/unit/test__struct.py +0 -0
  46. {sqlalchemy_bigquery-1.14.0 → sqlalchemy_bigquery-1.15.0}/tests/unit/test_alembic.py +0 -0
  47. {sqlalchemy_bigquery-1.14.0 → sqlalchemy_bigquery-1.15.0}/tests/unit/test_catalog_functions.py +0 -0
  48. {sqlalchemy_bigquery-1.14.0 → sqlalchemy_bigquery-1.15.0}/tests/unit/test_comments.py +0 -0
  49. {sqlalchemy_bigquery-1.14.0 → sqlalchemy_bigquery-1.15.0}/tests/unit/test_compiler.py +0 -0
  50. {sqlalchemy_bigquery-1.14.0 → sqlalchemy_bigquery-1.15.0}/tests/unit/test_compliance.py +0 -0
  51. {sqlalchemy_bigquery-1.14.0 → sqlalchemy_bigquery-1.15.0}/tests/unit/test_dialect_types.py +0 -0
  52. {sqlalchemy_bigquery-1.14.0 → sqlalchemy_bigquery-1.15.0}/tests/unit/test_engine.py +0 -0
  53. {sqlalchemy_bigquery-1.14.0 → sqlalchemy_bigquery-1.15.0}/tests/unit/test_geography.py +0 -0
  54. {sqlalchemy_bigquery-1.14.0 → sqlalchemy_bigquery-1.15.0}/tests/unit/test_helpers.py +0 -0
  55. {sqlalchemy_bigquery-1.14.0 → sqlalchemy_bigquery-1.15.0}/tests/unit/test_like_reescape.py +0 -0
  56. {sqlalchemy_bigquery-1.14.0 → sqlalchemy_bigquery-1.15.0}/tests/unit/test_parse_url.py +0 -0
  57. {sqlalchemy_bigquery-1.14.0 → sqlalchemy_bigquery-1.15.0}/tests/unit/test_select.py +0 -0
  58. {sqlalchemy_bigquery-1.14.0 → sqlalchemy_bigquery-1.15.0}/tests/unit/test_sqlalchemy_bigquery.py +0 -0
  59. {sqlalchemy_bigquery-1.14.0 → sqlalchemy_bigquery-1.15.0}/tests/unit/test_table_options.py +0 -0
  60. {sqlalchemy_bigquery-1.14.0 → sqlalchemy_bigquery-1.15.0}/tests/unit/test_version.py +0 -0
  61. {sqlalchemy_bigquery-1.14.0 → sqlalchemy_bigquery-1.15.0}/tests/unit/test_view.py +0 -0
  62. {sqlalchemy_bigquery-1.14.0 → sqlalchemy_bigquery-1.15.0}/third_party/sqlalchemy_bigquery_vendored/__init__.py +0 -0
  63. {sqlalchemy_bigquery-1.14.0 → sqlalchemy_bigquery-1.15.0}/third_party/sqlalchemy_bigquery_vendored/py.typed +0 -0
  64. {sqlalchemy_bigquery-1.14.0 → sqlalchemy_bigquery-1.15.0}/third_party/sqlalchemy_bigquery_vendored/sqlalchemy/AUTHORS +0 -0
  65. {sqlalchemy_bigquery-1.14.0 → sqlalchemy_bigquery-1.15.0}/third_party/sqlalchemy_bigquery_vendored/sqlalchemy/LICENSE +0 -0
  66. {sqlalchemy_bigquery-1.14.0 → sqlalchemy_bigquery-1.15.0}/third_party/sqlalchemy_bigquery_vendored/sqlalchemy/__init__.py +0 -0
  67. {sqlalchemy_bigquery-1.14.0 → sqlalchemy_bigquery-1.15.0}/third_party/sqlalchemy_bigquery_vendored/sqlalchemy/postgresql/__init__.py +0 -0
  68. {sqlalchemy_bigquery-1.14.0 → sqlalchemy_bigquery-1.15.0}/third_party/sqlalchemy_bigquery_vendored/sqlalchemy/postgresql/base.py +0 -0
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.4
2
2
  Name: sqlalchemy-bigquery
3
- Version: 1.14.0
3
+ Version: 1.15.0
4
4
  Summary: SQLAlchemy dialect for BigQuery
5
5
  Home-page: https://github.com/googleapis/python-bigquery-sqlalchemy
6
6
  Author: The Sqlalchemy-Bigquery Authors
@@ -17,10 +17,11 @@ Classifier: Programming Language :: Python :: 3.9
17
17
  Classifier: Programming Language :: Python :: 3.10
18
18
  Classifier: Programming Language :: Python :: 3.11
19
19
  Classifier: Programming Language :: Python :: 3.12
20
+ Classifier: Programming Language :: Python :: 3.13
20
21
  Classifier: Operating System :: OS Independent
21
22
  Classifier: Topic :: Database :: Front-Ends
22
23
  Obsoletes: pybigquery
23
- Requires-Python: >=3.8, <3.13
24
+ Requires-Python: >=3.8, <3.14
24
25
  Description-Content-Type: text/x-rst
25
26
  License-File: LICENSE
26
27
  License-File: AUTHORS
@@ -43,15 +44,29 @@ Requires-Dist: grpcio<2.0.0,>=1.47.0; extra == "bqstorage"
43
44
  Requires-Dist: grpcio<2.0.0,>=1.49.1; python_version >= "3.11" and extra == "bqstorage"
44
45
  Requires-Dist: pyarrow>=3.0.0; extra == "bqstorage"
45
46
  Provides-Extra: all
46
- Requires-Dist: GeoAlchemy2; extra == "all"
47
- Requires-Dist: pyarrow>=3.0.0; extra == "all"
48
- Requires-Dist: grpcio<2.0.0,>=1.47.0; extra == "all"
49
- Requires-Dist: shapely; extra == "all"
50
- Requires-Dist: alembic; extra == "all"
51
- Requires-Dist: packaging; extra == "all"
52
47
  Requires-Dist: google-cloud-bigquery-storage<3.0.0,>=2.0.0; extra == "all"
48
+ Requires-Dist: grpcio<2.0.0,>=1.47.0; extra == "all"
53
49
  Requires-Dist: pytz; extra == "all"
50
+ Requires-Dist: pyarrow>=3.0.0; extra == "all"
54
51
  Requires-Dist: grpcio<2.0.0,>=1.49.1; python_version >= "3.11" and extra == "all"
52
+ Requires-Dist: alembic; extra == "all"
53
+ Requires-Dist: shapely; extra == "all"
54
+ Requires-Dist: GeoAlchemy2; extra == "all"
55
+ Requires-Dist: packaging; extra == "all"
56
+ Dynamic: author
57
+ Dynamic: author-email
58
+ Dynamic: classifier
59
+ Dynamic: description
60
+ Dynamic: description-content-type
61
+ Dynamic: home-page
62
+ Dynamic: keywords
63
+ Dynamic: license-file
64
+ Dynamic: obsoletes
65
+ Dynamic: platform
66
+ Dynamic: provides-extra
67
+ Dynamic: requires-dist
68
+ Dynamic: requires-python
69
+ Dynamic: summary
55
70
 
56
71
  SQLAlchemy Dialect for BigQuery
57
72
  ===============================
@@ -106,7 +121,7 @@ dependencies.
106
121
 
107
122
  Supported Python Versions
108
123
  ^^^^^^^^^^^^^^^^^^^^^^^^^
109
- Python >= 3.8
124
+ Python >= 3.8, <3.14
110
125
 
111
126
  Unsupported Python Versions
112
127
  ^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -51,7 +51,7 @@ dependencies.
51
51
 
52
52
  Supported Python Versions
53
53
  ^^^^^^^^^^^^^^^^^^^^^^^^^
54
- Python >= 3.8
54
+ Python >= 3.8, <3.14
55
55
 
56
56
  Unsupported Python Versions
57
57
  ^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -104,6 +104,7 @@ setup(
104
104
  "Programming Language :: Python :: 3.10",
105
105
  "Programming Language :: Python :: 3.11",
106
106
  "Programming Language :: Python :: 3.12",
107
+ "Programming Language :: Python :: 3.13",
107
108
  "Operating System :: OS Independent",
108
109
  "Topic :: Database :: Front-Ends",
109
110
  ],
@@ -119,7 +120,7 @@ setup(
119
120
  "sqlalchemy>=1.4.16,<3.0.0",
120
121
  ],
121
122
  extras_require=extras,
122
- python_requires=">=3.8, <3.13",
123
+ python_requires=">=3.8, <3.14",
123
124
  tests_require=["packaging", "pytz"],
124
125
  entry_points={
125
126
  "sqlalchemy.dialects": ["bigquery = sqlalchemy_bigquery:BigQueryDialect"]
@@ -83,7 +83,7 @@ def _get_transitive_schema_fields(fields):
83
83
  results = []
84
84
  for field in fields:
85
85
  results += [field]
86
- if field.field_type in STRUCT_FIELD_TYPES:
86
+ if field.field_type in STRUCT_FIELD_TYPES and field.mode != "REPEATED":
87
87
  sub_fields = [
88
88
  SchemaField.from_api_repr(
89
89
  dict(f.to_api_repr(), name=f"{field.name}.{f.name}")
@@ -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.14.0"
20
+ __version__ = "1.15.0"
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.4
2
2
  Name: sqlalchemy-bigquery
3
- Version: 1.14.0
3
+ Version: 1.15.0
4
4
  Summary: SQLAlchemy dialect for BigQuery
5
5
  Home-page: https://github.com/googleapis/python-bigquery-sqlalchemy
6
6
  Author: The Sqlalchemy-Bigquery Authors
@@ -17,10 +17,11 @@ Classifier: Programming Language :: Python :: 3.9
17
17
  Classifier: Programming Language :: Python :: 3.10
18
18
  Classifier: Programming Language :: Python :: 3.11
19
19
  Classifier: Programming Language :: Python :: 3.12
20
+ Classifier: Programming Language :: Python :: 3.13
20
21
  Classifier: Operating System :: OS Independent
21
22
  Classifier: Topic :: Database :: Front-Ends
22
23
  Obsoletes: pybigquery
23
- Requires-Python: >=3.8, <3.13
24
+ Requires-Python: >=3.8, <3.14
24
25
  Description-Content-Type: text/x-rst
25
26
  License-File: LICENSE
26
27
  License-File: AUTHORS
@@ -43,15 +44,29 @@ Requires-Dist: grpcio<2.0.0,>=1.47.0; extra == "bqstorage"
43
44
  Requires-Dist: grpcio<2.0.0,>=1.49.1; python_version >= "3.11" and extra == "bqstorage"
44
45
  Requires-Dist: pyarrow>=3.0.0; extra == "bqstorage"
45
46
  Provides-Extra: all
46
- Requires-Dist: GeoAlchemy2; extra == "all"
47
- Requires-Dist: pyarrow>=3.0.0; extra == "all"
48
- Requires-Dist: grpcio<2.0.0,>=1.47.0; extra == "all"
49
- Requires-Dist: shapely; extra == "all"
50
- Requires-Dist: alembic; extra == "all"
51
- Requires-Dist: packaging; extra == "all"
52
47
  Requires-Dist: google-cloud-bigquery-storage<3.0.0,>=2.0.0; extra == "all"
48
+ Requires-Dist: grpcio<2.0.0,>=1.47.0; extra == "all"
53
49
  Requires-Dist: pytz; extra == "all"
50
+ Requires-Dist: pyarrow>=3.0.0; extra == "all"
54
51
  Requires-Dist: grpcio<2.0.0,>=1.49.1; python_version >= "3.11" and extra == "all"
52
+ Requires-Dist: alembic; extra == "all"
53
+ Requires-Dist: shapely; extra == "all"
54
+ Requires-Dist: GeoAlchemy2; extra == "all"
55
+ Requires-Dist: packaging; extra == "all"
56
+ Dynamic: author
57
+ Dynamic: author-email
58
+ Dynamic: classifier
59
+ Dynamic: description
60
+ Dynamic: description-content-type
61
+ Dynamic: home-page
62
+ Dynamic: keywords
63
+ Dynamic: license-file
64
+ Dynamic: obsoletes
65
+ Dynamic: platform
66
+ Dynamic: provides-extra
67
+ Dynamic: requires-dist
68
+ Dynamic: requires-python
69
+ Dynamic: summary
55
70
 
56
71
  SQLAlchemy Dialect for BigQuery
57
72
  ===============================
@@ -106,7 +121,7 @@ dependencies.
106
121
 
107
122
  Supported Python Versions
108
123
  ^^^^^^^^^^^^^^^^^^^^^^^^^
109
- Python >= 3.8
124
+ Python >= 3.8, <3.14
110
125
 
111
126
  Unsupported Python Versions
112
127
  ^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -41,6 +41,7 @@ tests/unit/__init__.py
41
41
  tests/unit/conftest.py
42
42
  tests/unit/fauxdbi.py
43
43
  tests/unit/test__struct.py
44
+ tests/unit/test__types.py
44
45
  tests/unit/test_alembic.py
45
46
  tests/unit/test_catalog_functions.py
46
47
  tests/unit/test_comments.py
@@ -0,0 +1,232 @@
1
+ # Copyright 2025 Google LLC
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
15
+ import pytest
16
+
17
+ from sqlalchemy_bigquery._types import _get_transitive_schema_fields
18
+ from google.cloud.bigquery.schema import SchemaField
19
+
20
+
21
+ def create_schema_field_from_dict(schema_dict):
22
+ """
23
+ Helper function to create a SchemaField object from a dictionary representation.
24
+ """
25
+ api_repr = {
26
+ "name": schema_dict["name"],
27
+ "type": schema_dict["type"],
28
+ "mode": schema_dict.get("mode", "NULLABLE"),
29
+ "fields": [
30
+ create_schema_field_from_dict(sf_dict).to_api_repr()
31
+ for sf_dict in schema_dict.get("fields", [])
32
+ ],
33
+ }
34
+ return SchemaField.from_api_repr(api_repr)
35
+
36
+
37
+ test_cases = [
38
+ (
39
+ "STRUCT field, not REPEATED, with sub-fields, should recurse",
40
+ [
41
+ create_schema_field_from_dict(
42
+ {
43
+ "name": "s1",
44
+ "type": "STRUCT",
45
+ "mode": "NULLABLE",
46
+ "fields": [
47
+ {"name": "child1", "type": "STRING", "mode": "NULLABLE"}
48
+ ],
49
+ }
50
+ )
51
+ ],
52
+ ["s1", "s1.child1"],
53
+ ),
54
+ (
55
+ "RECORD field (alias for STRUCT), not REPEATED, with sub-fields, should recurse",
56
+ [
57
+ create_schema_field_from_dict(
58
+ {
59
+ "name": "r1",
60
+ "type": "RECORD",
61
+ "mode": "NULLABLE",
62
+ "fields": [
63
+ {"name": "child_r1", "type": "INTEGER", "mode": "NULLABLE"}
64
+ ],
65
+ }
66
+ )
67
+ ],
68
+ ["r1", "r1.child_r1"],
69
+ ),
70
+ (
71
+ "STRUCT field, REPEATED, with sub-fields, should NOT recurse",
72
+ [
73
+ create_schema_field_from_dict(
74
+ {
75
+ "name": "s2",
76
+ "type": "STRUCT",
77
+ "mode": "REPEATED",
78
+ "fields": [
79
+ {"name": "child2", "type": "STRING", "mode": "NULLABLE"}
80
+ ],
81
+ }
82
+ )
83
+ ],
84
+ ["s2"],
85
+ ),
86
+ (
87
+ "Non-STRUCT field (STRING), not REPEATED, should NOT recurse",
88
+ [
89
+ create_schema_field_from_dict(
90
+ {"name": "f1", "type": "STRING", "mode": "NULLABLE"}
91
+ )
92
+ ],
93
+ ["f1"],
94
+ ),
95
+ (
96
+ "Non-STRUCT field (INTEGER), REPEATED, should NOT recurse",
97
+ [
98
+ create_schema_field_from_dict(
99
+ {"name": "f2", "type": "INTEGER", "mode": "REPEATED"}
100
+ )
101
+ ],
102
+ ["f2"],
103
+ ),
104
+ (
105
+ "Deeply nested STRUCT, not REPEATED, should recurse fully",
106
+ [
107
+ create_schema_field_from_dict(
108
+ {
109
+ "name": "s_outer",
110
+ "type": "STRUCT",
111
+ "mode": "NULLABLE",
112
+ "fields": [
113
+ {
114
+ "name": "s_inner1",
115
+ "type": "STRUCT",
116
+ "mode": "NULLABLE",
117
+ "fields": [
118
+ {
119
+ "name": "s_leaf1",
120
+ "type": "STRING",
121
+ "mode": "NULLABLE",
122
+ }
123
+ ],
124
+ },
125
+ {"name": "s_sibling", "type": "INTEGER", "mode": "NULLABLE"},
126
+ {
127
+ "name": "s_inner2_repeated_struct",
128
+ "type": "STRUCT",
129
+ "mode": "REPEATED",
130
+ "fields": [
131
+ {
132
+ "name": "s_leaf2_ignored",
133
+ "type": "BOOLEAN",
134
+ "mode": "NULLABLE",
135
+ }
136
+ ],
137
+ },
138
+ ],
139
+ }
140
+ )
141
+ ],
142
+ [
143
+ "s_outer",
144
+ "s_outer.s_inner1",
145
+ "s_outer.s_inner1.s_leaf1",
146
+ "s_outer.s_sibling",
147
+ "s_outer.s_inner2_repeated_struct",
148
+ ],
149
+ ),
150
+ (
151
+ "STRUCT field, not REPEATED, but no sub-fields, should not error and not recurse further",
152
+ [
153
+ create_schema_field_from_dict(
154
+ {"name": "s3", "type": "STRUCT", "mode": "NULLABLE", "fields": []}
155
+ )
156
+ ],
157
+ ["s3"],
158
+ ),
159
+ (
160
+ "Multiple top-level fields with mixed conditions",
161
+ [
162
+ create_schema_field_from_dict(
163
+ {"name": "id", "type": "INTEGER", "mode": "REQUIRED"}
164
+ ),
165
+ create_schema_field_from_dict(
166
+ {
167
+ "name": "user_profile",
168
+ "type": "STRUCT",
169
+ "mode": "NULLABLE",
170
+ "fields": [
171
+ {"name": "name", "type": "STRING", "mode": "NULLABLE"},
172
+ {
173
+ "name": "addresses",
174
+ "type": "RECORD",
175
+ "mode": "REPEATED",
176
+ "fields": [
177
+ {
178
+ "name": "street",
179
+ "type": "STRING",
180
+ "mode": "NULLABLE",
181
+ },
182
+ {"name": "city", "type": "STRING", "mode": "NULLABLE"},
183
+ ],
184
+ },
185
+ ],
186
+ }
187
+ ),
188
+ create_schema_field_from_dict(
189
+ {"name": "tags", "type": "STRING", "mode": "REPEATED"}
190
+ ),
191
+ ],
192
+ ["id", "user_profile", "user_profile.name", "user_profile.addresses", "tags"],
193
+ ),
194
+ (
195
+ "Empty input list of fields",
196
+ [],
197
+ [],
198
+ ),
199
+ (
200
+ "Field type not in STRUCT_FIELD_TYPES and mode is REPEATED",
201
+ [
202
+ create_schema_field_from_dict(
203
+ {"name": "f_arr", "type": "FLOAT", "mode": "REPEATED"}
204
+ )
205
+ ],
206
+ ["f_arr"],
207
+ ),
208
+ (
209
+ "Field type not in STRUCT_FIELD_TYPES and mode is not REPEATED",
210
+ [
211
+ create_schema_field_from_dict(
212
+ {"name": "f_single", "type": "DATE", "mode": "NULLABLE"}
213
+ )
214
+ ],
215
+ ["f_single"],
216
+ ),
217
+ ]
218
+
219
+
220
+ @pytest.mark.parametrize(
221
+ "description, input_fields_list, expected_field_names", test_cases
222
+ )
223
+ def test_get_transitive_schema_fields_conditions(
224
+ description, input_fields_list, expected_field_names
225
+ ):
226
+ """
227
+ Tests the _get_transitive_schema_fields function, focusing on the conditional logic
228
+ `if field.field_type in STRUCT_FIELD_TYPES and field.mode != "REPEATED":`.
229
+ """
230
+ result_fields = _get_transitive_schema_fields(input_fields_list)
231
+ result_names = [field.name for field in result_fields]
232
+ assert result_names == expected_field_names, description
@@ -8,14 +8,14 @@ sqlalchemy<3.0.0,>=1.4.16
8
8
  alembic
9
9
 
10
10
  [all]
11
- GeoAlchemy2
12
- pyarrow>=3.0.0
11
+ google-cloud-bigquery-storage<3.0.0,>=2.0.0
13
12
  grpcio<2.0.0,>=1.47.0
14
- shapely
13
+ pytz
14
+ pyarrow>=3.0.0
15
15
  alembic
16
+ shapely
17
+ GeoAlchemy2
16
18
  packaging
17
- google-cloud-bigquery-storage<3.0.0,>=2.0.0
18
- pytz
19
19
 
20
20
  [all:python_version >= "3.11"]
21
21
  grpcio<2.0.0,>=1.49.1