Closed aganchev1 closed 7 months ago
Hi @aganchev1 Can you try to update sqlalchemy to 2.0.22 ?
Ah yes that works, sorry I misunderstood the major version on the high-end of compatibility for a X.X.Y
Seems like the lower end of the compatibility should be raised though?
Many thanks for the quicky reply.
Checked other resources
Example Code
from langchain_community.document_loaders import WebBaseLoader loader = WebBaseLoader("https://docs.smith.langchain.com/user_guide")
docs = loader.load()
Error Message and Stack Trace (if applicable)
AttributeError Traceback (most recent call last) Cell In[1], line 1 ----> 1 from langchain_community.document_loaders import WebBaseLoader 2 loader = WebBaseLoader("https://docs.smith.langchain.com/user_guide") 4 docs = loader.load()
File ~\miniconda3\envs\python38\lib\site-packages\langchain_community\document_loaders__init__.py:191 189 from langchain_community.document_loaders.snowflake_loader import SnowflakeLoader 190 from langchain_community.document_loaders.spreedly import SpreedlyLoader --> 191 from langchain_community.document_loaders.sql_database import SQLDatabaseLoader 192 from langchain_community.document_loaders.srt import SRTLoader 193 from langchain_community.document_loaders.stripe import StripeLoader
File ~\miniconda3\envs\python38\lib\site-packages\langchain_community\document_loaders\sql_database.py:10 6 from langchain_community.document_loaders.base import BaseLoader 7 from langchain_community.utilities.sql_database import SQLDatabase ---> 10 class SQLDatabaseLoader(BaseLoader): 11 """ 12 Load documents by querying database tables supported by SQLAlchemy. 13 (...) 17 Each document represents one row of the result. 18 """ 20 def init( 21 self, 22 query: Union[str, sa.Select], (...) 30 include_query_into_metadata: bool = False, 31 ):
File ~\miniconda3\envs\python38\lib\site-packages\langchain_community\document_loaders\sql_database.py:22, in SQLDatabaseLoader() 10 class SQLDatabaseLoader(BaseLoader): 11 """ 12 Load documents by querying database tables supported by SQLAlchemy. 13 (...) 17 Each document represents one row of the result. 18 """ 20 def init( 21 self, ---> 22 query: Union[str, sa.Select], 23 db: SQLDatabase, 24 *, 25 parameters: Optional[Dict[str, Any]] = None, 26 page_content_mapper: Optional[Callable[..., str]] = None, 27 metadata_mapper: Optional[Callable[..., Dict[str, Any]]] = None, 28 source_columns: Optional[Sequence[str]] = None, 29 include_rownum_into_metadata: bool = False, 30 include_query_into_metadata: bool = False, 31 ): 32 """ 33 Args: 34 query: The query to execute. (...) 49 expression into the metadata dictionary. Default: False. 50 """ 51 self.query = query
AttributeError: module 'sqlalchemy' has no attribute 'Select'
Description
Hi All,
New to this project so apologies if I have misunderstood/missed anything. I am simply trying to follow the official documentation of langchain to familiarise myself with the functionality and encountering an error on the "Retrieval" example steps.
The community functions are supposed to be built on SQLAlchemy >=1.4 <1.4.3, but I'm getting the above error with SQLAlchemy 1.4 and 1.4.1. I believe the code needs to be updated? Or I am doing something wrong?
Any help much appreciated.
Thanks
System Info
aenum==3.1.15 aiohttp==3.9.3 aiosignal==1.3.1 altair==5.2.0 annotated-types==0.6.0 anyio==3.7.1 argon2-cffi==23.1.0 argon2-cffi-bindings==21.2.0 asn1crypto==1.5.1 asteval==0.9.23 astor==0.8.1 asttokens==2.4.1 async-timeout==4.0.3 attrs==23.2.0 Babel==2.14.0 backcall==0.2.0 backoff==2.2.1 backports.zoneinfo==0.2.1 beautifulsoup4==4.11.2 bleach==6.1.0 blinker==1.7.0 cachetools==5.3.3 certifi==2024.2.2 cffi==1.16.0 charset-normalizer==2.1.1 ChromeController==0.3.26 click==8.1.7 cloudpickle==2.0.0 colorama==0.4.6 comm==0.2.1 cryptography==36.0.2 cssselect==1.2.0 cssutils==2.9.0 cycler==0.12.1 dataclasses-json==0.6.4 dataframe-image==0.1.14 debugpy==1.8.1 decorator==5.1.1 defusedxml==0.7.1 deprecation==2.1.0 distro==1.9.0 docopt==0.6.2 entrypoints==0.4 et-xmlfile==1.1.0 exceptiongroup==1.2.0 exchange-calendars==4.2.8 executing==2.0.1 fastjsonschema==2.19.1 fds.analyticsapi.engines==5.6.0 fds.protobuf.stach==1.0.0 fds.protobuf.stach.extensions==1.3.1 fds.protobuf.stach.v2==1.0.2 filelock==3.13.1 fonttools==4.49.0 frozenlist==1.4.1 func-timeout==4.3.5 funcsigs==1.0.2 future==1.0.0 gitdb==4.0.11 GitPython==3.1.42 greenlet==3.0.3 gs-quant==0.9.108 h11==0.14.0 h2o==3.44.0.3 html2image==2.0.4.3 httpcore==1.0.4 httpx==0.27.0 idna==3.6 importlib-metadata==6.11.0 importlib_resources==6.1.3 inflection==0.5.1 ipykernel==6.29.3 ipython==8.12.3 ipython-genutils==0.2.0 ipywidgets==8.0.7 jedi==0.19.1 Jinja2==3.1.3 joblib==1.3.2 json5==0.9.22 jsonpatch==1.33 jsonpointer==2.4 jsonschema==4.21.1 jsonschema-specifications==2023.12.1 jupyter==1.0.0 jupyter-console==6.6.3 jupyter-server==1.24.0 jupyter_client==7.4.9 jupyter_core==5.7.1 jupyterlab==3.4.8 jupyterlab_pygments==0.3.0 jupyterlab_server==2.24.0 jupyterlab_widgets==3.0.10 kiwisolver==1.4.5 korean-lunar-calendar==0.3.1 langchain==0.1.11 langchain-community==0.0.27 langchain-core==0.1.30 langchain-openai==0.0.8 langchain-text-splitters==0.0.1 langsmith==0.1.23 lmfit==1.0.2 lxml==5.1.0 markdown-it-py==3.0.0 MarkupSafe==2.1.5 marshmallow==3.21.1 matplotlib==3.5.3 matplotlib-inline==0.1.6 mdurl==0.1.2 mistune==3.0.2 more-itertools==10.2.0 MouseInfo==0.1.3 msgpack==1.0.8 multidict==6.0.5 mypy-extensions==1.0.0 nbclassic==1.0.0 nbclient==0.9.0 nbconvert==7.16.2 nbformat==5.9.2 nest-asyncio==1.6.0 notebook==6.5.6 notebook_shim==0.2.4 numpy==1.23.5 openai==1.13.3 openpyxl==3.0.10 opentracing==2.4.0 orjson==3.9.15 oscrypto==1.3.0 packaging==23.2 pandas==1.4.4 pandas_market_calendars==4.3.3 pandocfilters==1.5.1 parso==0.8.3 patsy==0.5.6 pdfkit==1.0.0 pendulum==2.1.2 pickleshare==0.7.5 Pillow==9.5.0 pkgutil_resolve_name==1.3.10 platformdirs==4.2.0 premailer==3.10.0 prometheus_client==0.20.0 prompt-toolkit==3.0.43 protobuf==3.20.3 psutil==5.9.8 pure-eval==0.2.2 pyarrow==8.0.0 PyAutoGUI==0.9.54 pycparser==2.21 pycryptodomex==3.20.0 pydantic==2.6.3 pydantic_core==2.16.3 pydash==7.0.7 pydeck==0.8.1b0 PyGetWindow==0.0.9 Pygments==2.17.2 PyJWT==2.8.0 pyluach==2.2.0 Pympler==1.0.1 PyMsgBox==1.0.9 pyOpenSSL==22.0.0 pyparsing==3.1.2 pyperclip==1.8.2 pypiwin32==223 PyRect==0.2.0 PyScreeze==0.1.30 python-dateutil==2.8.2 python-decouple==3.8 python-dotenv==1.0.1 pytweening==1.2.0 pytz==2024.1 pytz-deprecation-shim==0.1.0.post0 pytzdata==2020.1 pywin32==306 pywinpty==2.0.13 PyYAML==6.0.1 pyzmq==24.0.1 qtconsole==5.5.1 QtPy==2.4.1 referencing==0.33.0 regex==2023.12.25 requests==2.28.2 rich==13.7.1 rpds-py==0.18.0 scikit-learn==1.3.2 scipy==1.9.3 seaborn==0.12.2 Send2Trash==1.8.2 six==1.16.0 slackclient==2.9.4 smmap==5.0.1 sniffio==1.3.1 snowflake-connector-python==2.7.12 snowflake-snowpark-python==0.9.0 snowflake-sqlalchemy==1.4.7 soupsieve==2.5 SQLAlchemy==1.4.0 stack-data==0.6.3 statsmodels==0.13.5 streamlit==1.23.1 streamlit-aggrid==0.3.4.post3 tabulate==0.9.0 tenacity==8.2.3 terminado==0.18.0 threadpoolctl==3.3.0 tiktoken==0.6.0 tinycss2==1.2.1 toml==0.10.2 tomli==2.0.1 toolz==0.12.1 tornado==6.4 tqdm==4.64.1 traitlets==5.14.1 typing-inspect==0.9.0 typing_extensions==4.10.0 tzdata==2024.1 tzlocal==4.3.1 uncertainties==3.1.7 urllib3==1.26.18 validators==0.22.0 watchdog==4.0.0 wcwidth==0.2.13 webencodings==0.5.1 websocket-client==1.7.0 websockets==12.0 widgetsnbextension==4.0.10 xlrd==2.0.1 yarl==1.9.4 zipp==3.17.0