Skip to content

Commit ec2b4d7

Browse files
committed
Map pg's uuid to graphene's uuid
1 parent c89cf80 commit ec2b4d7

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

Diff for: graphene_sqlalchemy/converter.py

+6-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
from sqlalchemy.orm import interfaces
55

66
from graphene import (ID, Boolean, Dynamic, Enum, Field, Float, Int, List,
7-
String)
7+
String, UUID)
88
from graphene.types.json import JSONString
99

1010
from .enums import enum_for_sa_enum
@@ -191,3 +191,8 @@ def convert_json_to_string(type, column, registry=None):
191191
@convert_sqlalchemy_type.register(JSONType)
192192
def convert_json_type_to_string(type, column, registry=None):
193193
return JSONString
194+
195+
196+
@convert_sqlalchemy_type.register(postgresql.UUID)
197+
def convert_column_to_uuid(type, column, registry=None):
198+
return UUID

Diff for: graphene_sqlalchemy/tests/test_converter.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,7 @@ class Meta:
252252

253253

254254
def test_should_postgresql_uuid_convert():
255-
assert get_field(postgresql.UUID()).type == graphene.String
255+
assert get_field(postgresql.UUID()).type == graphene.UUID
256256

257257

258258
def test_should_postgresql_enum_convert():

0 commit comments

Comments
 (0)