Skip to content

Commit 6bb53b2

Browse files
committed
Release 🍓 0.7.0
1 parent fc1eae8 commit 6bb53b2

File tree

3 files changed

+173
-168
lines changed

3 files changed

+173
-168
lines changed

CHANGELOG.md

Lines changed: 172 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,178 @@
11
CHANGELOG
22
=========
33

4+
0.7.0 - 2025-08-07
5+
------------------
6+
7+
Implement Relay-style cursor pagination for SQLAlchemy relationships by extending the connection resolver and DataLoader to accept pagination arguments, computing pageInfo metadata, and introducing cursor utilities. Add PaginatedLoader to scope DataLoader instances per pagination parameters and update tests to verify pagination behavior.
8+
9+
**New Features**:
10+
- Support cursor-based pagination (first, after, last, before) on GraphQL relationship fields
11+
- Introduce PaginatedLoader to manage DataLoader instances per pagination configuration
12+
13+
**Enhancements**:
14+
- Extend connection resolvers to compute pageInfo fields (hasNextPage, hasPreviousPage, totalCount) and handle forward and backward pagination
15+
- Add utilities for cursor encoding/decoding and relationship key extraction
16+
17+
**Tests**:
18+
- Add comprehensive tests for forward and backward pagination scenarios in both synchronous and asynchronous execution contexts
19+
20+
**Examples**:
21+
22+
Get the first three books for a specific author:
23+
24+
```gql
25+
query {
26+
author(id: 1) {
27+
id
28+
name
29+
books(first: 3) {
30+
edges {
31+
node {
32+
id
33+
title
34+
}
35+
}
36+
pageInfo {
37+
hasNextPage
38+
hasPreviousPage
39+
startCursor
40+
endCursor
41+
}
42+
}
43+
}
44+
}
45+
```
46+
47+
Get all books after a specific book's cursor:
48+
49+
```gql
50+
query($afterBook: String) {
51+
author(id: 1) {
52+
id
53+
name
54+
books(after: $afterBook) {
55+
edges {
56+
node {
57+
id
58+
title
59+
}
60+
}
61+
pageInfo {
62+
hasNextPage
63+
hasPreviousPage
64+
startCursor
65+
endCursor
66+
}
67+
}
68+
}
69+
}
70+
```
71+
72+
Get the first three books for a specific author after a specific book's cursor:
73+
74+
```gql
75+
query($afterBook: String) {
76+
author(id: 1) {
77+
id
78+
name
79+
books(first: 3, after: $afterBook) {
80+
edges {
81+
node {
82+
id
83+
title
84+
}
85+
}
86+
pageInfo {
87+
hasNextPage
88+
hasPreviousPage
89+
startCursor
90+
endCursor
91+
}
92+
}
93+
}
94+
}
95+
```
96+
97+
98+
Get the last three books for a specific author:
99+
100+
```gql
101+
query {
102+
author(id: 1) {
103+
id
104+
name
105+
books(last: 3) {
106+
edges {
107+
node {
108+
id
109+
title
110+
}
111+
}
112+
pageInfo {
113+
hasNextPage
114+
hasPreviousPage
115+
startCursor
116+
endCursor
117+
}
118+
}
119+
}
120+
}
121+
```
122+
123+
Get all books before a specific book's cursor:
124+
125+
```gql
126+
query($beforeBook: String) {
127+
author(id: 1) {
128+
id
129+
name
130+
books(before: $beforeBook) {
131+
edges {
132+
node {
133+
id
134+
title
135+
}
136+
}
137+
pageInfo {
138+
hasNextPage
139+
hasPreviousPage
140+
startCursor
141+
endCursor
142+
}
143+
}
144+
}
145+
}
146+
```
147+
148+
Get the last three books for a specific author before a specific book's cursor:
149+
150+
```gql
151+
query($beforeBook: String) {
152+
author(id: 1) {
153+
id
154+
name
155+
books(last: 3, before: $beforeBook) {
156+
edges {
157+
node {
158+
id
159+
title
160+
}
161+
}
162+
pageInfo {
163+
hasNextPage
164+
hasPreviousPage
165+
startCursor
166+
endCursor
167+
}
168+
}
169+
}
170+
}
171+
```
172+
173+
Contributed by [David Roeca](https://github.com/davidroeca) via [PR #255](https://github.com/strawberry-graphql/strawberry-sqlalchemy/pull/255/)
174+
175+
4176
0.6.4 - 2025-07-08
5177
------------------
6178

RELEASE.md

Lines changed: 0 additions & 167 deletions
This file was deleted.

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[tool.poetry]
22
name = "strawberry-sqlalchemy-mapper"
33
packages = [{ include = "strawberry_sqlalchemy_mapper", from = "src" }]
4-
version = "0.6.4"
4+
version = "0.7.0"
55
description = "A library for autogenerating Strawberry GraphQL types from SQLAlchemy models."
66
authors = ["Tim Dumol <[email protected]>"]
77
license = "MIT"

0 commit comments

Comments
 (0)