Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitfcb0bc6

Browse files
author
Jim Fulton
authored
fix: underscores weren't allowed in struct field names when passing parameters to the DB API (#930)
1 parentbd417d3 commitfcb0bc6

File tree

4 files changed

+10
-6
lines changed

4 files changed

+10
-6
lines changed

‎google/cloud/bigquery/dbapi/_helpers.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ def _parse_type(
173173
\s*
174174
(ARRAY|STRUCT|RECORD) # Type
175175
\s*
176-
<([A-Z0-9<> ,()]+)> # Subtype(s)
176+
<([A-Z0-9_<> ,()]+)> # Subtype(s)
177177
\s*$
178178
""",
179179
re.IGNORECASE|re.VERBOSE,

‎google/cloud/bigquery/dbapi/cursor.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -494,7 +494,7 @@ def _extract_types(
494494
([^:)]*) # name
495495
(?:: # ':' introduces type
496496
( # start of type group
497-
[a-zA-Z0-9<>, ]+ # First part, no parens
497+
[a-zA-Z0-9_<>, ]+ # First part, no parens
498498
499499
(?: # start sets of parens + non-paren text
500500
\([0-9 ,]+\) # comma-separated groups of digits in parens

‎tests/unit/test_dbapi__helpers.py‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -612,8 +612,8 @@ def test_complex_query_parameter_type_errors(type_, value, expect):
612612
"parameters,parameter_types,expect",
613613
[
614614
(
615-
[[],dict(name="ch1",bdate=datetime.date(2021,1,1))],
616-
["ARRAY<INT64>","struct<name string,bdate date>"],
615+
[[],dict(name="ch1",b_date=datetime.date(2021,1,1))],
616+
["ARRAY<INT64>","struct<name string,b_date date>"],
617617
[
618618
{
619619
"parameterType": {"arrayType": {"type":"INT64"},"type":"ARRAY"},
@@ -623,13 +623,13 @@ def test_complex_query_parameter_type_errors(type_, value, expect):
623623
"parameterType": {
624624
"structTypes": [
625625
{"name":"name","type": {"type":"STRING"}},
626-
{"name":"bdate","type": {"type":"DATE"}},
626+
{"name":"b_date","type": {"type":"DATE"}},
627627
],
628628
"type":"STRUCT",
629629
},
630630
"parameterValue": {
631631
"structValues": {
632-
"bdate": {"value":"2021-01-01"},
632+
"b_date": {"value":"2021-01-01"},
633633
"name": {"value":"ch1"},
634634
}
635635
},

‎tests/unit/test_dbapi_cursor.py‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -809,6 +809,10 @@ def test__format_operation_no_placeholders(self):
809809
"values(%%%%%(foo:INT64)s, %(bar)s)",
810810
("values(%%%%%(foo)s, %(bar)s)",dict(foo="INT64")),
811811
),
812+
(
813+
"values(%%%%%(foo:struct<x_1 string, y_ int64>)s, %(bar)s)",
814+
("values(%%%%%(foo)s, %(bar)s)",dict(foo="struct<x_1 string, y_ int64>")),
815+
),
812816
(
813817
"values(%%%%%(foo:struct<x string, y int64>)s, %(bar)s)",
814818
("values(%%%%%(foo)s, %(bar)s)",dict(foo="struct<x string, y int64>")),

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp