-
Notifications
You must be signed in to change notification settings - Fork 47
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
feat: enable experimental async use of driver #901
base: main
Are you sure you want to change the base?
Conversation
FYI: I had to patch |
That shouldn't be required, you should just be able to pass |
latest version of SQLAlchemy is more explicit I followed the psycopg3 engine example, and created AsyncDuckDbDialect as a subclass of the original dialect
|
This PR currently has a merge conflict. Please resolve this and then re-add the |
the method @sinaiy mentioned works for me in the mean time. here it is with type hints import logging
import typing as t
import duckdb_engine
from pydantic_core import from_json, to_json
from sqlalchemy import URL, pool, util
from sqlalchemy.ext.asyncio import AsyncEngine, create_async_engine
# Assuming the logger is already configured elsewhere
logger = logging.getLogger(__name__)
class AsyncDialect(duckdb_engine.Dialect):
is_async = True
@classmethod
def get_pool_class(cls, url: URL):
async_fallback = url.query.get("async_fallback", False)
if util.asbool(async_fallback):
return pool.FallbackAsyncAdaptedQueuePool
else:
return pool.AsyncAdaptedQueuePool
duckdb_engine.Dialect.get_async_dialect_cls = lambda cls: AsyncDialect # type: ignore |
No description provided.