graphql-python / graphql-python/graphene-sqlalchemy

object of type 'SQLAlchemyConnectionField' has no len()

Open
#236 2 comments 1 reaction 0 assignees View on GitHub
Dominant language
Python
Stars
985
Forks
223
PR merge metrics
No merged PRs in 30d

Description

Hello,

I am implementing a connection field.

The excerpts from the code are:

```
# Classes:
class Common(graphene_sqlalchemy.SQLAlchemyObjectType):
class Meta:
abstract = True
...

class MyGraphQLModel(Common):
class Meta:
model = MyModel
interfaces = (graphene.relay.Node, )

# Fields:
mymodels = graphene.List(MyGraphQLModel)
def mymodels(p,i):
query = MyGraphQLModel.get_query(i)
return query.all()

connection_mymodels = graphene_sqlalchemy.SQLAlchemyConnectionField(MyGraphQLModel)
```

The first field (`mymodels`) which is an array without a connection works fine.
The second field which is a connection gives error:

```
"message": "object of type 'SQLAlchemyConnectionField' has no len()",
```

Any ideas? Thanks.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.