Skip to content

Commit 55464ec

Browse files
committed
Add JSON type compiler support
Fixes #399
1 parent 150143c commit 55464ec

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

sqlalchemy_bigquery/_types.py

+2
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@
4747
"STRUCT": STRUCT,
4848
"TIMESTAMP": sqlalchemy.types.TIMESTAMP,
4949
"TIME": sqlalchemy.types.TIME,
50+
"JSON": sqlalchemy.types.JSON,
5051
}
5152

5253
# By convention, dialect-provided types are spelled with all upper case.
@@ -66,6 +67,7 @@
6667
STRING = _type_map["STRING"]
6768
TIMESTAMP = _type_map["TIMESTAMP"]
6869
TIME = _type_map["TIME"]
70+
JSON = _type_map["JSON"]
6971

7072
try:
7173
_type_map["GEOGRAPHY"] = GEOGRAPHY

sqlalchemy_bigquery/base.py

+3
Original file line numberDiff line numberDiff line change
@@ -641,6 +641,9 @@ def visit_NUMERIC(self, type_, **kw):
641641

642642
visit_DECIMAL = visit_NUMERIC
643643

644+
def visit_JSON(self, type_, **kw):
645+
return "JSON"
646+
644647

645648
class BigQueryDDLCompiler(DDLCompiler):
646649
option_datatype_mapping = {

0 commit comments

Comments
 (0)