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

Commit65d676d

Browse files
committed
move bindparam workaround to visit_JSON
1 parentd0fd734 commit65d676d

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

‎sqlalchemy_bigquery/base.py‎

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -548,10 +548,7 @@ def visit_bindparam(
548548
bq_type=self.__remove_type_parameter(bq_type)
549549

550550
ifbq_type=="JSON":
551-
# FIXME: JSON is not a member of `SqlParameterScalarTypes` in the DBAPI
552-
# For now, we hack around this by:
553-
# - Rewriting the bindparam type to STRING
554-
# - Applying a bind expression that converts the parameter back to JSON
551+
555552
bq_type="STRING"
556553

557554
assert_(param!="%s",f"Unexpected param:{param}")
@@ -649,6 +646,14 @@ def visit_NUMERIC(self, type_, **kw):
649646
visit_DECIMAL=visit_NUMERIC
650647

651648
defvisit_JSON(self,type_,**kw):
649+
ifisinstance(
650+
kw.get("type_expression"),sqlalchemy.sql.expression.BindParameter
651+
):# bindparam
652+
# FIXME: JSON is not a member of `SqlParameterScalarTypes` in the DBAPI
653+
# For now, we hack around this by:
654+
# - Rewriting the bindparam type to STRING
655+
# - Applying a bind expression that converts the parameter back to JSON
656+
return"STRING"
652657
return"JSON"
653658

654659

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp