This repository was archived by the owner on Jun 24, 2024. It is now read-only.
This repository was archived by the owner on Jun 24, 2024. It is now read-only.
JSON column not recognized #11
Open
Description
Assuming the next snippet when creating a JSON column:
from sqlalchemy.types import JSON as BaseJSON
from sqlalchemy.dialects import postgresql
JSON = BaseJSON()
JSON = JSON.with_variant(postgresql.JSONB, 'postgresql')
I've noticed that the query did not work. Digging into the guts of py-mongosql
I found this code:
def _is_column_json(col: MapperProperty) -> bool:
""" Is the column a PostgreSql JSON column? """
return isinstance(_get_column_type(col), (pg.JSON, pg.JSONB))
I was wondering if is not more correct to check against sqlalchemy.sql.sqltypes.JSON
since it is the most generic type and base to the more specific posgresql
variants. Is there any reason to keep it limited like it is?
I will make a PR with my suggested fix and a RFC.
Metadata
Metadata
Assignees
Labels
No labels