feat: add async seeders (AsyncSeeder, AsyncHybridSeeder) - #72
Merged
Conversation
Bridge the existing sync seeders onto AsyncSession via run_sync, so projects using an async engine can seed without a separate sync engine. The hybrid seeder's mid-traversal filter queries run through the async driver inside the greenlet, needing no async reimplementation. Exports are guarded in __init__ so sync-only installs without greenlet still import cleanly. Adds an `async` install extra, aiosqlite/greenlet dev deps, async tests, and README/docs coverage. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This was referenced Jul 7, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds async counterparts to the existing seeders for projects running on an
AsyncSession.What
AsyncSeeder/AsyncHybridSeeder— same entities andinstancesAPI as the sync seeders, butseed()is awaitable.AsyncSession.run_sync, so afilter-key query still executes against the async driver mid-traversal — no async reimplementation of the walk.__init__, so sync-only installs without greenlet still import cleanly.asyncinstall extra (pip install "sqlalchemyseed[async]") pulls greenlet; users still bring their own async driver.Tests
3 new async tests (
unittest.IsolatedAsyncioTestCase) against in-memoryaiosqlite, covering nested relationships,add_to_session=False, and thefilter-key path that exercises real async driver I/O. Full suite: 93 passed.Docs
docs/async.rst, wired into the toctree.🤖 Generated with Claude Code