Closed nickyi1990 closed 11 months ago
Same thing here. I think Mapped
is from SQLAlchemy >= 2.0.0
but the current requirement is SQLAlchemy > 1.3
. I hope the fix remains compatible with SQLAlchemy > 1.3
and not the other way around.
Mapped
was added in 1.4:
.. tip::
The :class:`_orm.Mapped` class represents attributes that are handled
directly by the :class:`_orm.Mapper` class. It does not include other
Python descriptor classes that are provided as extensions, including
:ref:`hybrids_toplevel` and the :ref:`associationproxy_toplevel`.
While these systems still make use of ORM-specific superclasses
and structures, they are not :term:`instrumented` by the
:class:`_orm.Mapper` and instead provide their own functionality
when they are accessed on a class.
.. versionadded:: 1.4
I am updating the deps to declare 1.4 as a min requirement, but i cannot assign the issue to myself :/
Hey added a fix for it in this PR. SQLAlchemy support for Mapped
is from v1.4. https://github.com/hwchase17/langchain/pull/3716. Meanwhile you can simply upgrade your SQLAlchemy package to 1.4
Updating SQLAlchemy from 1.3 to 1.4 is not "easy". It would be much better if Mapped
is removed and the constraint for >1.3
is kept instead. I think Mapped
is only for annotation purposes and doesn't serve any other use.
Ahh, ok. I always thought the big migration was from 1.* -> 2. If it's there for annotations, then yeah, I agree with you.
Hi, @NickYi1990! I'm Dosu, and I'm helping the LangChain team manage their backlog. I wanted to let you know that we are marking this issue as stale.
Based on my understanding, the issue you reported is an ImportError that occurs when trying to import 'Mapped' from 'sqlalchemy.orm'. It seems that the error is encountered when running code that involves the 'langchain' package. In the comments, users hrist0stoichev and MichaelJThomas-2016 discuss that 'Mapped' is from SQLAlchemy 1.4, but the current requirement is SQLAlchemy 1.3. vempaliakhil96 suggests upgrading SQLAlchemy to 1.4 and provides a fix in a PR, while hrist0stoichev suggests removing 'Mapped' and keeping the constraint for >1.3. MichaelJThomas-2016 agrees with this suggestion.
The issue has been resolved by removing the import of 'Mapped' from 'sqlalchemy.orm' and keeping the constraint for SQLAlchemy version >1.3.
Before we close this issue, we wanted to check with you if it is still relevant to the latest version of the LangChain repository. If it is, please let us know by commenting on the issue. Otherwise, feel free to close the issue yourself or it will be automatically closed in 7 days.
Thank you for your contribution to LangChain!
have no idea, just install langchain and run code below, the error popup, any idea?