Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions sqlalchemy_bigquery/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -620,6 +620,9 @@ def visit_BINARY(self, type_, **kw):

visit_VARBINARY = visit_BLOB = visit_BINARY

def visit_JSON(self, type_, **kw):
return "JSON"

def visit_NUMERIC(self, type_, **kw):
if (type_.precision is not None) and isinstance(
kw.get("type_expression"), Column
Expand Down
12 changes: 12 additions & 0 deletions tests/unit/test_table_options.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,18 @@ def test_table_default_rounding_mode_dialect_option(faux_conn):
)


def test_table_with_json_columns(faux_conn):
setup_table(
faux_conn,
"some_table",
sqlalchemy.Column("some_stuff", sqlalchemy.JSON),
)

assert " ".join(faux_conn.test_data["execute"][-1][0].strip().split()) == (
"CREATE TABLE `some_table` ( `some_stuff` JSON )"
)


def test_table_clustering_fields_dialect_option_no_such_column(faux_conn):
with pytest.raises(sqlalchemy.exc.NoSuchColumnError):
setup_table(
Expand Down
Loading