An API paginated with this library returns a `Page[Model]` object: the items, the counts, and the URLs of the previous and next pages. The same `Page` comes back whether the data was read through SQLModel or through Neontology, which talks to Neo4j and Memgraph. The clients of the API, and its OpenAPI schema, therefore do not change when the storage does.
The project in detail
It came out of a precise need, on a production application that reads part of its data from PostgreSQL and part of it from a knowledge graph, and exposes both through the same REST API. Existing pagination libraries cover SQLAlchemy well and graph stores not at all: each data source had ended up with its own page format, and the front end had to special-case them. Pulling the page object out into a library forced a single contract on both sides.
This is why I publish code like this rather than keeping it. A local patch inside one project helps nobody and nobody reviews it; a public package has a version, tests, a licence and a stable surface, and the code running for a client no longer depends on a fix only that client knows about.
Its tests cover the two read paths separately, SQLModel pagination on one side, the graph and the building of Cypher clauses on the other, and check the behaviour when an optional dependency is absent. That last point matters: the library must not require Neo4j of a project that only uses PostgreSQL, nor the other way round.
First published on PyPI on 28 October 2026, under the MIT licence; it supports Python 3.11 and above. Its documentation has its own site, built and published with the code it describes.