-
Notifications
You must be signed in to change notification settings - Fork 5.2k
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
Conversation
# 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 |
There was a problem hiding this comment.
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
6d77111
to
b01eb04
Compare
4fdcf8b
to
8e26821
Compare
5b28132
to
a2a3ae5
Compare
@@ -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") |
There was a problem hiding this comment.
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.
Should fix #5495 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice.
LGTM
e9e7ebe
to
9931ba6
Compare
See https://alembic.sqlalchemy.org/en/latest/cookbook.html#using-asyncio-with-alembic