The agent engineering platform.
Python agentsaiai-agentsanthropicchatgptdeepagentsenterpriseframeworkgeminigenerative-ailangchainlanggraphllmmultiagentopen-sourceopenaipydanticpythonragtypescript
dont error on sql import (#4647)
Harrison Chased5a070454425
diff --git a/langchain/memory/chat_message_histories/sql.py b/langchain/memory/chat_message_histories/sql.pyindex e3770133b2..40f8691cd8 100644--- a/langchain/memory/chat_message_histories/sql.py+++ b/langchain/memory/chat_message_histories/sql.py@@ -3,7 +3,8 @@ import loggingfrom typing import Listfrom sqlalchemy import Column, Integer, Text, create_engine-from sqlalchemy.orm import declarative_base, sessionmaker+from sqlalchemy.ext.declarative import declarative_base+from sqlalchemy.orm import sessionmakerfrom langchain.schema import (AIMessage,diff --git a/langchain/sql_database.py b/langchain/sql_database.pyindex fc0a5098ae..337af0e81b 100644--- a/langchain/sql_database.py+++ b/langchain/sql_database.py@@ -13,7 +13,7 @@ from sqlalchemy import (select,text,)-from sqlalchemy.engine import CursorResult, Engine+from sqlalchemy.engine import Enginefrom sqlalchemy.exc import ProgrammingError, SQLAlchemyErrorfrom sqlalchemy.schema import CreateTable@@ -196,7 +196,7 @@ class SQLDatabase:try:# get the sample rowswith self._engine.connect() as connection:- sample_rows_result: CursorResult = connection.execute(command)+ sample_rows_result = connection.execute(command) # type: ignore# shorten values in the sample rowssample_rows = list(map(lambda ls: [str(i)[:100] for i in ls], sample_rows_result)diff --git a/langchain/vectorstores/analyticdb.py b/langchain/vectorstores/analyticdb.pyindex 02f3be63f2..bb32549b45 100644--- a/langchain/vectorstores/analyticdb.py+++ b/langchain/vectorstores/analyticdb.py@@ -8,7 +8,8 @@ from typing import Any, Dict, Iterable, List, Optional, Tupleimport sqlalchemyfrom sqlalchemy import REAL, Indexfrom sqlalchemy.dialects.postgresql import ARRAY, JSON, UUID-from sqlalchemy.orm import Session, declarative_base, relationship+from sqlalchemy.ext.declarative import declarative_base+from sqlalchemy.orm import Session, relationshipfrom sqlalchemy.sql.expression import funcfrom langchain.docstore.document import Document