|
9 | 9 | from sqlalchemy.dialects import postgresql
|
10 | 10 | from sqlalchemy.orm import interfaces, strategies
|
11 | 11 |
|
12 |
| -from graphene import (ID, Boolean, Date, DateTime, Dynamic, Enum, Field, Float, |
13 |
| - Int, List, String, Time) |
| 12 | +from graphene import (ID, Boolean, Date, Time, DateTime, Dynamic, Enum, Field, Float, |
| 13 | + Int, List, String, Time, UUID) |
14 | 14 | from graphene.types.json import JSONString
|
15 | 15 |
|
16 | 16 | from .batching import get_batch_resolver
|
|
30 | 30 |
|
31 | 31 | try:
|
32 | 32 | from sqlalchemy_utils import (ChoiceType, JSONType, ScalarListType,
|
33 |
| - TSVectorType) |
| 33 | + TSVectorType, UUIDType) |
34 | 34 | except ImportError:
|
35 |
| - ChoiceType = JSONType = ScalarListType = TSVectorType = object |
| 35 | + ChoiceType = JSONType = ScalarListType = TSVectorType = UUIDType = object |
36 | 36 |
|
37 | 37 | try:
|
38 | 38 | from sqlalchemy_utils.types.choice import EnumTypeImpl
|
@@ -199,29 +199,31 @@ def convert_sqlalchemy_type(type, column, registry=None):
|
199 | 199 | @convert_sqlalchemy_type.register(types.Text)
|
200 | 200 | @convert_sqlalchemy_type.register(types.Unicode)
|
201 | 201 | @convert_sqlalchemy_type.register(types.UnicodeText)
|
202 |
| -@convert_sqlalchemy_type.register(postgresql.UUID) |
203 | 202 | @convert_sqlalchemy_type.register(postgresql.INET)
|
204 | 203 | @convert_sqlalchemy_type.register(postgresql.CIDR)
|
205 | 204 | @convert_sqlalchemy_type.register(TSVectorType)
|
206 | 205 | def convert_column_to_string(type, column, registry=None):
|
207 | 206 | return String
|
208 | 207 |
|
209 | 208 |
|
| 209 | +@convert_sqlalchemy_type.register(postgresql.UUID) |
| 210 | +@convert_sqlalchemy_type.register(UUIDType) |
| 211 | +def convert_column_to_uuid(type, column, registry=None): |
| 212 | + return UUID |
| 213 | + |
| 214 | + |
210 | 215 | @convert_sqlalchemy_type.register(types.DateTime)
|
211 | 216 | def convert_column_to_datetime(type, column, registry=None):
|
212 |
| - from graphene.types.datetime import DateTime |
213 | 217 | return DateTime
|
214 | 218 |
|
215 | 219 |
|
216 | 220 | @convert_sqlalchemy_type.register(types.Time)
|
217 | 221 | def convert_column_to_time(type, column, registry=None):
|
218 |
| - from graphene.types.datetime import Time |
219 | 222 | return Time
|
220 | 223 |
|
221 | 224 |
|
222 | 225 | @convert_sqlalchemy_type.register(types.Date)
|
223 | 226 | def convert_column_to_date(type, column, registry=None):
|
224 |
| - from graphene.types.datetime import Date |
225 | 227 | return Date
|
226 | 228 |
|
227 | 229 |
|
|
0 commit comments