[WIP] feat: Automated SQLAlchemy integration#1321
[WIP] feat: Automated SQLAlchemy integration#1321KarolJagodzinski wants to merge 1 commit intomainfrom
Conversation
|
Caution Review failedFailed to post review comments 📝 WalkthroughWalkthroughAdds a new SQLAlchemy 2.0 contrib to Ariadne: guarded exports, dataloader + registry, request extension, SQLAlchemy-backed ObjectType and QueryType, auto-eager-load utilities, examples, docs, packaging extras, and extensive tests; plus small unrelated internal refinements and docs/checklist tweaks. ChangesSQLAlchemy 2.0 Integration for Ariadne
Sequence Diagram(s)sequenceDiagram
participant Client
participant GraphQL as GraphQL Server
participant Eager as auto_eager_load
participant SQLA as SQLAlchemy
participant DB
Client->>GraphQL: send GraphQL query
GraphQL->>Eager: analyze selection set
Eager->>SQLA: apply load strategies (selectinload/joinedload)
SQLA->>DB: execute optimized queries
DB-->>SQLA: return rows
SQLA-->>Eager: loaded related objects
Eager-->>GraphQL: resolved nested fields
GraphQL-->>Client: return response
sequenceDiagram
participant Client
participant GraphQL as GraphQL Server
participant Resolver
participant Registry as Loader Registry
participant DataLoader
participant SQLA as SQLAlchemy
participant DB
Client->>GraphQL: request field with relations
GraphQL->>Resolver: invoke field resolver
Resolver->>Registry: obtain DataLoader for relation
Registry->>DataLoader: schedule batch load
DataLoader->>SQLA: execute WHERE IN / multi-col IN
SQLA->>DB: run query
DB-->>SQLA: rows
SQLA-->>DataLoader: fetched rows
DataLoader-->>Resolver: grouped results
Resolver-->>GraphQL: return resolved value
GraphQL-->>Client: response
Estimated code review effort🎯 4 (Complex) | ⏱️ ~75 minutes Suggested reviewers
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Tip 💬 Introducing Slack Agent: The best way for teams to turn conversations into code.Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.
Built for teams:
One agent for your entire SDLC. Right inside Slack. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #1321 +/- ##
==========================================
+ Coverage 97.25% 97.45% +0.20%
==========================================
Files 127 140 +13
Lines 9214 10331 +1117
==========================================
+ Hits 8961 10068 +1107
- Misses 253 263 +10 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
fcb998f to
0d3908d
Compare
0d3908d to
6f2b5fc
Compare
Add experimental SQLAlchemy integration: ariadne.contrib.sqlalchemy
Introduces an opt-in module (pip install ariadne[sqlalchemy]) that wires SQLAlchemy 2.0 models into Ariadne with two cooperating execution paths:
actually asked for.
batching lookups to avoid N+1.
What's included
Status
Experimental. API may change based on feedback before it's locked in.
Summary by CodeRabbit
New Features
Documentation
Examples
Tests
Chores