Closed
Description
Due to the following lines:
graphene-sqlalchemy/graphene_sqlalchemy/converter.py
Lines 19 to 22 in 421f8e4
Graphene will break with the following message when SQLAlchemy-Utils
is installed:
Exception: Don't know how to convert the SQLAlchemy field Foo.bar (<class 'sqlalchemy.sql.schema.Column'>)
where Foo.bar is a TSTZRANGE type as follows:
In [11]: from script import base_script
...: from sqlalchemy.inspection import inspect as sqlalchemyinspect
...: from graphene_sqlalchemy.converter import convert_sqlalchemy_type
...: from singledispatch import _compose_mro
...: from foo import Foo
...:
...: inspected_model = sqlalchemyinspect(Foo)
...: print(inspected_model.columns.items()[5])
...: name, column = inspected_model.columns.items()[5]
...: model_hierarchy = _compose_mro(
...: column.type.__class__, convert_sqlalchemy_type.registry.keys()
...: )
...: reg = convert_sqlalchemy_type.registry
...: for model in model_hierarchy:
...: if model in reg:
...: print(model, reg[model])
...:
...: print(model_hierarchy)
...:
('bar', Column('bar', TSTZRANGE(), table=<foos>, nullable=False))
<class 'object'> <function convert_sqlalchemy_type at 0x108f88560>
[<class 'sqlalchemy.dialects.postgresql.ranges.TSTZRANGE'>, <class 'sqlalchemy.dialects.postgresql.ranges.RangeOperators'>, <class 'sqlalchemy.sql.type_api.TypeEngine'>, <class 'sqlalchemy.sql.visitors.Visitable'>, <class 'object'>]