Skip to content

Commit 902fa93

Browse files
committed
Bugfix
- allow SQLALchemyConnectionField.connection for all SQLAlchemyBase types
1 parent 09d2421 commit 902fa93

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

graphene_sqlalchemy/fields.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,14 +26,14 @@
2626
class SQLAlchemyConnectionField(ConnectionField):
2727
@property
2828
def type(self):
29-
from .types import SQLAlchemyObjectType
29+
from .types import SQLAlchemyBase
3030

3131
type_ = super(ConnectionField, self).type
3232
nullable_type = get_nullable_type(type_)
3333
if issubclass(nullable_type, Connection):
3434
return type_
35-
assert issubclass(nullable_type, SQLAlchemyObjectType), (
36-
"SQLALchemyConnectionField only accepts SQLAlchemyObjectType types, not {}"
35+
assert issubclass(nullable_type, SQLAlchemyBase), (
36+
"SQLALchemyConnectionField only accepts SQLAlchemyBase types, not {}"
3737
).format(nullable_type.__name__)
3838
assert nullable_type.connection, "The type {} doesn't have a connection".format(
3939
nullable_type.__name__

graphene_sqlalchemy/tests/test_fields.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ def resolver(_obj, _info):
5151

5252

5353
def test_type_assert_sqlalchemy_object_type():
54-
with pytest.raises(AssertionError, match="only accepts SQLAlchemyObjectType"):
54+
with pytest.raises(AssertionError, match="only accepts SQLAlchemyBase types"):
5555
SQLAlchemyConnectionField(ObjectType).type
5656

5757

0 commit comments

Comments
 (0)