-
Notifications
You must be signed in to change notification settings - Fork 13.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix compatiblity with SQLAlchemy 1.3 #3958
Fix compatiblity with SQLAlchemy 1.3 #3958
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
im thinking we should just drop support for 1.3
not sure if worth upkeep
Or maybe make SQLAlchemy an optional dependency? 99% of langchain can be used without it and we are currently at a point where we can't update langchain because we use sqlalchemy 1.3 |
+1 for supporting 1.3, the 1.3 => 1.4 migration isn't easy |
@hrist0stoichev hows this? this changes it so there won't be any errors on import. we could look into making truly optional, but would take a bit more effort |
(if you want to make truly optional, id accept that pr instead) |
yeah, #4647 looks good enough |
sounds like this has been resolved, let me know if i'm missing something! |
Related to this issue and this PR.
It seems there are more thing that depends on
sqlalchemy >= 1.4
so I'm fixing those in this PR. Also, locking SQLAlchemy to1.3.24
so that the build step will fail if something that depends onsqlalchemy >= 1.4
is added.from sqlalchemy.orm import declarative_base
->from sqlalchemy.ext.declarative import declarative_base
with Session()
->session = Session(); try: ... finally: session.close()
query().where()
->query().filter()
-where
is synonym forfilter
in 1.4select()
->query()
- Theselect
API is quite different in 1.3.exec_driver_sql()
->execute()
- this is a synonym in 1.4I realize this change is becoming quite complex so another approach might be to just revert my previous PR and start depending on
sqlalchemy >= 1.4
again but I still think that backwards compatibility is more important for a library so I will just submit this PR for review.