Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Use Alembic with async driver #6258

Merged
merged 1 commit into from
Feb 11, 2025
Merged

Conversation

cbornet
Copy link
Collaborator

@cbornet cbornet commented Feb 11, 2025

@cbornet cbornet requested a review from ogabrielluiz February 11, 2025 14:09
@dosubot dosubot bot added the size:M This PR changes 30-99 lines, ignoring generated files. label Feb 11, 2025
# Even though the docs say this is the default, it raises an error
# if we don't specify it.
# https://docs.sqlalchemy.org/en/20/errors.html#pool-class-cannot-be-used-with-asyncio-engine-or-vice-versa
pool = AsyncAdaptedQueuePool
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not needed anymore since we upgrade sqlalchemy to 2.0.38

@cbornet cbornet changed the title Use Alembic with async driver feat: Use Alembic with async driver Feb 11, 2025
@github-actions github-actions bot added enhancement New feature or request and removed enhancement New feature or request labels Feb 11, 2025
@cbornet cbornet removed the request for review from ogabrielluiz February 11, 2025 14:17
@cbornet cbornet marked this pull request as draft February 11, 2025 14:17
@cbornet cbornet force-pushed the async-alembic branch 2 times, most recently from 6d77111 to b01eb04 Compare February 11, 2025 14:25
@github-actions github-actions bot added enhancement New feature or request and removed enhancement New feature or request labels Feb 11, 2025
@cbornet cbornet force-pushed the async-alembic branch 2 times, most recently from 4fdcf8b to 8e26821 Compare February 11, 2025 14:54
@github-actions github-actions bot added enhancement New feature or request and removed enhancement New feature or request labels Feb 11, 2025
@cbornet cbornet added the lgtm This PR has been approved by a maintainer label Feb 11, 2025
@cbornet cbornet marked this pull request as ready for review February 11, 2025 15:02
@dosubot dosubot bot added size:XXL This PR changes 1000+ lines, ignoring generated files. and removed size:M This PR changes 30-99 lines, ignoring generated files. labels Feb 11, 2025
@cbornet cbornet added the DO NOT MERGE Don't Merge this PR label Feb 11, 2025
@dosubot dosubot bot removed the size:XXL This PR changes 1000+ lines, ignoring generated files. label Feb 11, 2025
@github-actions github-actions bot added enhancement New feature or request and removed enhancement New feature or request labels Feb 11, 2025
@cbornet cbornet removed DO NOT MERGE Don't Merge this PR labels Feb 11, 2025
@github-actions github-actions bot added enhancement New feature or request and removed enhancement New feature or request labels Feb 11, 2025
@@ -75,6 +75,12 @@ def blockbuster(request):
.can_block_in("langchain_core/_api/internal.py", "is_caller_internal")
)

for func in ["os.stat", "os.path.abspath", "os.scandir"]:
bb.functions[func].can_block_in("alembic/util/pyfiles.py", "load_python_file")
Copy link
Collaborator Author

@cbornet cbornet Feb 11, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alembic makes a few blocking os calls. Now that we use the async driver, these calls will happen on the event loop. These shouldn't have a big impact as thses blockings are short and migrations happen only at startup.

@cbornet
Copy link
Collaborator Author

cbornet commented Feb 11, 2025

Should fix #5495

Copy link
Contributor

@ogabrielluiz ogabrielluiz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice.

LGTM

@github-actions github-actions bot added enhancement New feature or request and removed enhancement New feature or request labels Feb 11, 2025
@dosubot dosubot bot added size:L This PR changes 100-499 lines, ignoring generated files. and removed size:M This PR changes 30-99 lines, ignoring generated files. labels Feb 11, 2025
@github-actions github-actions bot added enhancement New feature or request and removed enhancement New feature or request labels Feb 11, 2025
@cbornet cbornet added this pull request to the merge queue Feb 11, 2025
Merged via the queue into langflow-ai:main with commit ffbc97b Feb 11, 2025
23 of 32 checks passed
@cbornet cbornet deleted the async-alembic branch February 11, 2025 23:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request lgtm This PR has been approved by a maintainer size:L This PR changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants