|
28 | 28 | from typing import _ForwardRef as ForwardRef
|
29 | 29 |
|
30 | 30 | try:
|
31 |
| - import sqlalchemy_utils as sqa_utils |
| 31 | + from sqlalchemy_utils.types.choice import EnumTypeImpl |
32 | 32 | except ImportError:
|
33 |
| - sqlalchemy_utils = DummyImport() |
| 33 | + EnumTypeImpl = object |
34 | 34 |
|
35 | 35 | try:
|
36 |
| - from sqa_utils.types.choice import EnumTypeImpl |
| 36 | + import sqlalchemy_utils as sqa_utils |
37 | 37 | except ImportError:
|
38 |
| - EnumTypeImpl = object |
| 38 | + sqa_utils = DummyImport() |
39 | 39 |
|
40 | 40 | is_selectin_available = getattr(strategies, 'SelectInLoader', None)
|
41 | 41 |
|
@@ -257,6 +257,8 @@ def convert_enum_to_enum(type, column, registry=None):
|
257 | 257 | def convert_choice_to_enum(type, column, registry=None):
|
258 | 258 | name = "{}_{}".format(column.table.name, column.key).upper()
|
259 | 259 | if isinstance(type.type_impl, EnumTypeImpl):
|
| 260 | + print("AAAA") |
| 261 | + print(EnumTypeImpl) |
260 | 262 | # type.choices may be Enum/IntEnum, in ChoiceType both presented as EnumMeta
|
261 | 263 | # do not use from_enum here because we can have more than one enum column in table
|
262 | 264 | return graphene.Enum(name, list((v.name, v.value) for v in type.choices))
|
@@ -410,7 +412,8 @@ def convert_sqlalchemy_hybrid_property_union(arg):
|
410 | 412 | "Please add the corresponding hybrid_property to the excluded fields in the ObjectType, "
|
411 | 413 | "or use an ORMField to override this behaviour.")
|
412 | 414 |
|
413 |
| - return graphene_union_for_py_union(cast(typing.List[graphene.ObjectType], list(graphene_types)), get_global_registry()) |
| 415 | + return graphene_union_for_py_union(cast(typing.List[graphene.ObjectType], list(graphene_types)), |
| 416 | + get_global_registry()) |
414 | 417 |
|
415 | 418 |
|
416 | 419 | @convert_sqlalchemy_hybrid_property_type.register(lambda x: getattr(x, '__origin__', None) in [list, typing.List])
|
|
0 commit comments