File tree Expand file tree Collapse file tree 1 file changed +9
-7
lines changed Expand file tree Collapse file tree 1 file changed +9
-7
lines changed Original file line number Diff line number Diff line change @@ -59,7 +59,7 @@ class Query:
59
59
@strawberry .field
60
60
@staticmethod
61
61
async def parents (info : Info ) -> List [StrawberryParent ]:
62
- return info .context ["session" ].execute ( sa . select ( Parent ) ).all ()
62
+ return info .context ["session" ].query ( Parent ).all ()
63
63
64
64
mapper .finalize ()
65
65
base .metadata .create_all (engine )
@@ -90,15 +90,15 @@ async def execute():
90
90
# Notice how we use a sync session but call Strawberry's async execute.
91
91
# This is not an ideal combination, but it's certainly a common one that
92
92
# we need to support efficiently.
93
- await schema .execute (
93
+ result = await schema .execute (
94
94
"""
95
95
query {
96
96
parents {
97
- a { edges { node { id } } },
98
- b { edges { node { id } } },
99
- c { edges { node { id } } },
100
- d { edges { node { id } } },
101
- e { edges { node { id } } },
97
+ a { id },
98
+ b { id },
99
+ c { id },
100
+ d { id },
101
+ e { id },
102
102
}
103
103
}
104
104
""" ,
@@ -109,5 +109,7 @@ async def execute():
109
109
),
110
110
},
111
111
)
112
+ assert not result .errors
113
+ assert len (result .data ["parents" ]) == 10
112
114
113
115
benchmark (async_to_sync (execute ))
You can’t perform that action at this time.
0 commit comments