mirror of
https://github.com/hwchase17/langchain
synced 2024-11-18 09:25:54 +00:00
community[patch]: fix database uri type in SQLDatabase (#22661)
**Description** sqlalchemy uses "sqlalchemy.engine.URL" type for db uri argument. Added 'URL' type for compatibility. **Issue**: None **Dependencies:** None --------- Co-authored-by: Bagatur <baskaryan@gmail.com>
This commit is contained in:
parent
5dbbdcbf8e
commit
b6bf2bb234
@ -14,7 +14,7 @@ from sqlalchemy import (
|
||||
select,
|
||||
text,
|
||||
)
|
||||
from sqlalchemy.engine import Engine, Result
|
||||
from sqlalchemy.engine import URL, Engine, Result
|
||||
from sqlalchemy.exc import ProgrammingError, SQLAlchemyError
|
||||
from sqlalchemy.schema import CreateTable
|
||||
from sqlalchemy.sql.expression import Executable
|
||||
@ -128,7 +128,10 @@ class SQLDatabase:
|
||||
|
||||
@classmethod
|
||||
def from_uri(
|
||||
cls, database_uri: str, engine_args: Optional[dict] = None, **kwargs: Any
|
||||
cls,
|
||||
database_uri: Union[str, URL],
|
||||
engine_args: Optional[dict] = None,
|
||||
**kwargs: Any,
|
||||
) -> SQLDatabase:
|
||||
"""Construct a SQLAlchemy engine from URI."""
|
||||
_engine_args = engine_args or {}
|
||||
|
Loading…
Reference in New Issue
Block a user