Skip to content

[DT-2731] Enables pagination support#4

Draft
ntoro-healx wants to merge 9 commits intomasterfrom
DT-2731-support-pagination
Draft

[DT-2731] Enables pagination support#4
ntoro-healx wants to merge 9 commits intomasterfrom
DT-2731-support-pagination

Conversation

@ntoro-healx
Copy link
Copy Markdown

This pull request introduces several improvements and new features to the GraphLayer library and its example projects. The main highlights are the addition of schema sorting for GraphQL, enhanced SQLAlchemy query support with offset, updates for compatibility with modern dependencies, and improved documentation for contributors. Below are the most important changes:

GraphQL Schema Sorting and Testing

  • Added support for lexicographic sorting of the GraphQL schema via a new sort_schema parameter in create_graphql_schema, executor, and execute, ensuring consistent field ordering in generated documentation and SDL output (graphlayer/graphql/__init__.py, graphlayer/graphql/schema.py). [1] [2] [3] [4]
  • Introduced tests to verify that schema sorting does not affect data resolution and works with field arguments (tests/graphql/test_graphql.py).

SQLAlchemy Query Enhancements

  • Added support for the SQL OFFSET clause in the internal _SqlQuery class and its builder methods (limit, offset, etc.), and ensured the offset is correctly passed and applied during query resolution (graphlayer/sqlalchemy.py). [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11]

Dependency and Compatibility Updates

  • Updated JavaScript dependencies for the GraphiQL example to the latest major versions, including graphiql, graphql, react, and related build tools, and updated the Webpack configuration for compatibility (examples/sqlalchemy/graphiql/package.json, examples/sqlalchemy/graphiql/webpack.config.js). [1] [2]
  • Bumped Python dependency requirements to Python 3.9+ and updated graphql-core to 3.2.6 (setup.py). [1] [2]

Documentation and Developer Experience

  • Added a new CLAUDE.md file with clear build, test, and architecture instructions to guide contributors and AI tools working with the codebase.

Example and API Improvements

  • Refactored several example resolvers to use the more flexible lambda graph, field_query: gsql.join(...) pattern, improving clarity and extensibility in resolver definitions (examples/intro_sqlalchemy.py, examples/sqlalchemy/booksapp/graph/authors.py, examples/sqlalchemy/booksapp/graph/books.py). [1] [2] [3]
  • Fixed a bug in the Flask GraphQL example to return the correct data structure (response.data) in API responses (examples/sqlalchemy/booksapp/server.py).

alexhermida and others added 9 commits February 11, 2025 16:18
Update graphql-core requirement
Upgrade&fix Graphiql and sqlalchemy examples
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Add offset() method to _SqlQuery for skip-based pagination. The offset
is preserved through query chaining (where, order_by, limit, group_by,
index_by) and works with joins.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants