Skip to content

Commit de42c7c

Browse files
committed
Add additional sqlalchemy_utils types
Add most trivial string types from sqlalchemy_utils: UUIDType, EmailType, URLType, and IPAddressType
1 parent 421f8e4 commit de42c7c

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

graphene_sqlalchemy/converter.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,11 @@
1717
from .resolvers import get_attr_resolver, get_custom_resolver
1818

1919
try:
20-
from sqlalchemy_utils import ChoiceType, JSONType, ScalarListType, TSVectorType
20+
from sqlalchemy_utils import (ChoiceType, JSONType, ScalarListType, TSVectorType,
21+
UUIDType, EmailType, URLType, IPAddressType)
2122
except ImportError:
2223
ChoiceType = JSONType = ScalarListType = TSVectorType = object
24+
UUIDType = EmailType = URLType = IPAddressType = object
2325

2426

2527
is_selectin_available = getattr(strategies, 'SelectInLoader', None)
@@ -184,6 +186,10 @@ def convert_sqlalchemy_type(type, column, registry=None):
184186
@convert_sqlalchemy_type.register(postgresql.INET)
185187
@convert_sqlalchemy_type.register(postgresql.CIDR)
186188
@convert_sqlalchemy_type.register(TSVectorType)
189+
@convert_sqlalchemy_type.register(UUIDType)
190+
@convert_sqlalchemy_type.register(EmailType)
191+
@convert_sqlalchemy_type.register(URLType)
192+
@convert_sqlalchemy_type.register(IPAddressType)
187193
def convert_column_to_string(type, column, registry=None):
188194
return String
189195

0 commit comments

Comments
 (0)