graphql-python / graphql-python/graphene-sqlalchemy

ORMField batching results in null result

Đang mở
#401 1 bình luận 5 reaction 0 người được giao Xem trên GitHub
Ngôn ngữ chính
Python
Star
985
Fork
223
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Mô tả

I'm trying to get batching set up on a 1:N relationship. Suppose a `Foo` has many `Bar`s

```python
class FooObject(SQLAlchemyObjectType):
class Meta:
model = Foo
interfaces = (graphene.relay.Node,)

bars = ORMField(batching=True)
```
(I've also tried doing `batching=True` in the `Meta`)

```python
class Query(graphene.ObjectType):
test_query_batching = graphene.Field(
lambda: graphene.List(FooObject),
)

def resolve_test_foo_query_batching(self, info):
return Foo.query.limit(5).all()
```

Querying this resolver as such

```graphql
query TestQueryBatching {
testQueryBatching {
id
bars {
edges {
node {
id
}
}
}
}
}
```

results in `Cannot return null for non-nullable field BarObjectConnection.edges`. This query succeeds if `batching` is disabled. I'm unsure as to why we'd be getting null for `BarObjectConnection.edges`, though. Any ideas as to what might be leading to this?

Versions:
- SQLAlchemy==1.4.51
- Flask-SQLAlchemy==2.5.1
- graphene-sqlalchemy==3.0.0rc1

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.