mirror of
https://github.com/hwchase17/langchain.git
synced 2025-06-23 07:09:31 +00:00
Re-add Support for SQLAlchemy <1.4 (#6895)
Support for SQLAlchemy 1.3 was removed in version 0.0.203 by change #6086. Re-adding support. - Description: Imports SQLAlchemy Row at class creation time instead of at init to support SQLAlchemy <1.4. This is the only breaking change and was introduced in version 0.0.203 #6086. A similar change was merged before: https://github.com/hwchase17/langchain/pull/4647 - Dependencies: Reduces SQLAlchemy dependency to > 1.3 - Tag maintainer: @rlancemartin, @eyurtsev, @hwchase17, @wangxuqi --------- Co-authored-by: rlm <pexpresss31@gmail.com>
This commit is contained in:
parent
20c6ade2fc
commit
9ca1cf003c
@ -7,7 +7,6 @@ from typing import Any, Dict, Iterable, List, Optional, Sequence, Tuple, Type
|
||||
|
||||
from sqlalchemy import REAL, Column, String, Table, create_engine, insert, text
|
||||
from sqlalchemy.dialects.postgresql import ARRAY, JSON, TEXT
|
||||
from sqlalchemy.engine import Row
|
||||
|
||||
try:
|
||||
from sqlalchemy.orm import declarative_base
|
||||
@ -260,6 +259,14 @@ class AnalyticDB(VectorStore):
|
||||
filter: Optional[dict] = None,
|
||||
) -> List[Tuple[Document, float]]:
|
||||
# Add the filter if provided
|
||||
try:
|
||||
from sqlalchemy.engine import Row
|
||||
except ImportError:
|
||||
raise ImportError(
|
||||
"Could not import Row from sqlalchemy.engine. "
|
||||
"Please 'pip install sqlalchemy>=1.4'."
|
||||
)
|
||||
|
||||
filter_condition = ""
|
||||
if filter is not None:
|
||||
conditions = [
|
||||
|
Loading…
Reference in New Issue
Block a user