From a077dc33bda01363a9f0c6ec86cc0ff12801b349 Mon Sep 17 00:00:00 2001 From: Eduardo Lezcano Alvarez Date: Wed, 9 Feb 2022 12:58:49 +0100 Subject: [PATCH] fix: Using generic types when checking _is_column_json and _is_column_array --- mongosql/bag.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/mongosql/bag.py b/mongosql/bag.py index 232c0c0..c0a0c64 100644 --- a/mongosql/bag.py +++ b/mongosql/bag.py @@ -4,7 +4,7 @@ from sqlalchemy import inspect, TypeDecorator from sqlalchemy import Column -from sqlalchemy.dialects import postgresql as pg +from sqlalchemy.sql import sqltypes as st from sqlalchemy.ext.associationproxy import AssociationProxy from sqlalchemy.ext.hybrid import hybrid_property @@ -809,12 +809,12 @@ def _get_column_type(col: MapperProperty) -> TypeEngine: def _is_column_array(col: MapperProperty) -> bool: """ Is the column a PostgreSql ARRAY column? """ - return isinstance(_get_column_type(col), pg.ARRAY) + return isinstance(_get_column_type(col), st.ARRAY) def _is_column_json(col: MapperProperty) -> bool: """ Is the column a PostgreSql JSON column? """ - return isinstance(_get_column_type(col), (pg.JSON, pg.JSONB)) + return isinstance(_get_column_type(col), st.JSON) def _is_relationship_array(rel: RelationshipProperty) -> bool: