From 90c742c3345dd07fbb5d3c134124d10059db3013 Mon Sep 17 00:00:00 2001 From: Andreas Motl Date: Tue, 16 Jan 2024 02:59:48 +0100 Subject: [PATCH] Types: Emulate PostgreSQL's `JSON(B)` types using CrateDB's `OBJECT` --- src/sqlalchemy_cratedb/compiler.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/sqlalchemy_cratedb/compiler.py b/src/sqlalchemy_cratedb/compiler.py index 7b2c5ccd..636ebbab 100644 --- a/src/sqlalchemy_cratedb/compiler.py +++ b/src/sqlalchemy_cratedb/compiler.py @@ -254,6 +254,12 @@ def visit_TIMESTAMP(self, type_, **kw): """ return "TIMESTAMP %s" % ((type_.timezone and "WITH" or "WITHOUT") + " TIME ZONE",) + def visit_JSON(self, type_, **kw): + return "OBJECT" + + def visit_JSONB(self, type_, **kw): + return "OBJECT" + class CrateCompiler(compiler.SQLCompiler): def visit_getitem_binary(self, binary, operator, **kw):