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

Appearance settings

Commit 153b82a

Browse filesBrowse files
authored
fix(sqlalchemy-bigquery): Support Creation of JSON columns (#16733)
Fixes #15761
1 parent 36ca46b commit 153b82a
Copy full SHA for 153b82a

2 files changed

+15Lines changed: 15 additions & 0 deletions

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎packages/sqlalchemy-bigquery/sqlalchemy_bigquery/base.py‎

Copy file name to clipboardExpand all lines: packages/sqlalchemy-bigquery/sqlalchemy_bigquery/base.py
+3Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -622,6 +622,9 @@ def visit_BINARY(self, type_, **kw):
622622

623623
visit_VARBINARY = visit_BLOB = visit_BINARY
624624

625+
def visit_JSON(self, type_, **kw):
626+
return "JSON"
627+
625628
def visit_NUMERIC(self, type_, **kw):
626629
if (type_.precision is not None) and isinstance(
627630
kw.get("type_expression"), Column
Collapse file

‎packages/sqlalchemy-bigquery/tests/unit/test_table_options.py‎

Copy file name to clipboardExpand all lines: packages/sqlalchemy-bigquery/tests/unit/test_table_options.py
+12Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,18 @@ def test_table_default_rounding_mode_dialect_option(faux_conn):
6262
)
6363

6464

65+
def test_table_with_json_columns(faux_conn):
66+
setup_table(
67+
faux_conn,
68+
"some_table",
69+
sqlalchemy.Column("some_stuff", sqlalchemy.JSON),
70+
)
71+
72+
assert " ".join(faux_conn.test_data["execute"][-1][0].strip().split()) == (
73+
"CREATE TABLE `some_table` ( `some_stuff` JSON )"
74+
)
75+
76+
6577
def test_table_clustering_fields_dialect_option_no_such_column(faux_conn):
6678
with pytest.raises(sqlalchemy.exc.NoSuchColumnError):
6779
setup_table(

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.