graphql-python / graphql-python/graphene-sqlalchemy

object of type 'SQLAlchemyConnectionField' has no len()

Offen
#236 2 Kommentare 1 Reaktion 0 zugewiesene Personen Auf GitHub ansehen
Vorherrschende Sprache
Python
Sterne
985
Forks
223
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Beschreibung

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.

Beitragsleitfaden

Beitragsleitfaden öffnen

Bewertung

Dieses Issue wurde noch nicht bewertet.

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.