Skip to content

Commit 8ea2086

Browse files
Forever-Youngjnak
authored andcommitted
Add support for generic SQLAlchemy Array type (#246)
1 parent 5eb5559 commit 8ea2086

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

graphene_sqlalchemy/converter.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -171,8 +171,9 @@ def convert_scalar_list_to_list(type, column, registry=None):
171171
return List(String)
172172

173173

174+
@convert_sqlalchemy_type.register(types.ARRAY)
174175
@convert_sqlalchemy_type.register(postgresql.ARRAY)
175-
def convert_postgres_array_to_list(_type, column, registry=None):
176+
def convert_array_to_list(_type, column, registry=None):
176177
inner_type = convert_sqlalchemy_type(column.type.item_type, column)
177178
return List(inner_type)
178179

graphene_sqlalchemy/tests/test_converter.py

+6
Original file line numberDiff line numberDiff line change
@@ -297,6 +297,12 @@ def test_should_postgresql_array_convert():
297297
assert field.type.of_type == graphene.Int
298298

299299

300+
def test_should_array_convert():
301+
field = get_field(types.ARRAY(types.Integer))
302+
assert isinstance(field.type, graphene.List)
303+
assert field.type.of_type == graphene.Int
304+
305+
300306
def test_should_postgresql_json_convert():
301307
assert get_field(postgresql.JSON()).type == graphene.JSONString
302308

0 commit comments

Comments
 (0)