-
Hi, I am trying to call the My context is SQLAlchemy and Strawberry GraphQL. That's my dummy code: def get_viewer_catalogue_items(root: "Viewer", info: Info[Context, "Viewer"]) -> LimitCursorPage500[ProductResponse]:
cursor = CursorParams()
return paginate(info.context.db, select(Product).where(Product.userId == info.context.user.id).order_by(Product.id), cursor) How can I pass CursorParams without getting an error, is there another paginate function I need to call or use another Params class? |
Beta Was this translation helpful? Give feedback.
Answered by
uriyyo
Sep 24, 2023
Replies: 1 comment 1 reply
-
Hi @maciossek, You should also call from fastapi_pagination import set_page
def get_viewer_catalogue_items(root: "Viewer", info: Info[Context, "Viewer"]) -> LimitCursorPage500[ProductResponse]:
cursor = CursorParams()
set_page(LimitCursorPage500[ProductResponse])
return paginate(info.context.db, select(Product).where(Product.userId == info.context.user.id).order_by(Product.id), cursor) |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
maciossek
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi @maciossek,
You should also call
set_page
if you usepaginate
outside the route: