graphql-python / graphql-python/graphene-sqlalchemy

object of type 'SQLAlchemyConnectionField' has no len()

Aberta
#236 2 comentários 1 reação 0 responsáveis Ver no GitHub
Linguagem predominante
Python
Estrelas
985
Forks
223
Métricas de merge de PRs
Nenhum PR com merge em 30d

Descrição

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.

Guia de contribuição

Abrir o guia de contribuição

Direção de pesquisa

Start with the SQLAlchemyConnectionField implementation and the traceback for the reported len() error, then reproduce it using the MyGraphQLModel schema and connection_mymodels field shown here. Done means the connection field resolves without raising the TypeError and the existing list field remains working.

Escrita pelo modelo de indexação a partir do texto da issue.

Avaliação

Stack de tecnologia
graphql, python, sqlalchemy
Domínio
api, backend
Tipo de issue
Bug
Dificuldade
3/5
Tempo estimado
1-2 dias
Status de atividade
Estagnada
Clareza
Precisa de esclarecimento
Facilidade para iniciantes
25/100

Receba novas issues na sua caixa de entrada

Um resumo curto de issues do GitHub para quem está começando.