From b5140691abfa29efe5412887b3597456b1700dbc Mon Sep 17 00:00:00 2001 From: Ian Rose Date: Tue, 10 Sep 2019 11:24:07 -0700 Subject: [PATCH] Allow postgres client to read tables with UUID, JSON, JSONB types. --- ibis/expr/datatypes.py | 3 +++ ibis/sql/alchemy.py | 15 +++++++++++++++ 2 files changed, 18 insertions(+) diff --git a/ibis/expr/datatypes.py b/ibis/expr/datatypes.py index 599a04d6d539..301d2c496d1d 100644 --- a/ibis/expr/datatypes.py +++ b/ibis/expr/datatypes.py @@ -129,6 +129,9 @@ def _literal_value_hash_key(self, value) -> int: class Any(DataType): + scalar = ir.AnyScalar + column = ir.AnyColumn + __slots__ = () diff --git a/ibis/sql/alchemy.py b/ibis/sql/alchemy.py index 8d4621cd5011..62102e5537b5 100644 --- a/ibis/sql/alchemy.py +++ b/ibis/sql/alchemy.py @@ -136,6 +136,21 @@ def sa_double(_, satype, nullable=True): return dt.Double(nullable=nullable) +@dt.dtype.register(PostgreSQLDialect, sa.dialects.postgresql.UUID) +def sa_uuid(_, satype, nullable=True): + return dt.Any(nullable=nullable) + + +@dt.dtype.register(PostgreSQLDialect, sa.dialects.postgresql.JSON) +def sa_json(_, satype, nullable=True): + return dt.Any(nullable=nullable) + + +@dt.dtype.register(PostgreSQLDialect, sa.dialects.postgresql.JSONB) +def sa_jsonb(_, satype, nullable=True): + return dt.Any(nullable=nullable) + + if geospatial_supported: @dt.dtype.register(SQLAlchemyDialect, (ga.Geometry, ga.types._GISType))