The session setup has to be done twice and ideally there should be a single point of contact for it.
As of now, there's a session setup for the Dataloader injected in the context and one for the relay connections, e.g.:
Session Setup For Dataloaders
# context is expected to have an instance of StrawberrySQLAlchemyLoader
class CustomGraphQLView(GraphQLView):
def get_context(self):
return {
"sqlalchemy_loader": StrawberrySQLAlchemyLoader(bind=YOUR_SESSION),
}
Session Setup For Relay
@mapper.type(fruit_table)
class Fruit(relay.Node):
id: relay.NodeID[int]
@strawberry.type
class Query:
fruits: relay.ListConnection[Fruit] = connection(sessionmaker=sessionmaker)
The issue had already been spotted by the author on this comment: #65 (comment) and discussed on a community-chat session.
The session setup has to be done twice and ideally there should be a single point of contact for it.
As of now, there's a session setup for the Dataloader injected in the context and one for the relay connections, e.g.:
Session Setup For Dataloaders
Session Setup For Relay
The issue had already been spotted by the author on this comment: #65 (comment) and discussed on a community-chat session.