SQLAlchemy Minimum Version Requirement at least 1.4.29
First Check
- [X] I added a very descriptive title to this issue.
- [X] I used the GitHub search to find a similar issue and didn't find it.
- [X] I searched the SQLModel documentation, with the integrated search.
- [X] I already searched in Google "How to X in SQLModel" and didn't find any information.
- [X] I already read and followed all the tutorial in the docs and didn't find an answer.
- [X] I already checked if it is not related to SQLModel but to Pydantic.
- [X] I already checked if it is not related to SQLModel but to SQLAlchemy.
Commit to Help
- [X] I commit to help with one of those options 👆
Example Code
from typing import Optional
from sqlmodel import Field, SQLModel, Session, create_engine
class Hero(SQLModel, table=True):
id: Optional[int] = Field(default=None, primary_key=True)
name: str
secret_name: str
age: Optional[int] = None
hero_1 = Hero(id=1, name="Pink Panther", secret_name="Jacques Clouseau", age=59)
engine = create_engine("sqlite:///database.db", echo=True)
SQLModel.metadata.create_all(engine)
with Session(engine) as session:
session.add(hero_1)
session.commit()
session.get(Hero, 1)
Description
In version 0.0.7 the new Session.get() parameter execution_options was added, however this parameter is not available in SQLAlchemy version <1.4.29 (see here). I think the minimum SQLAlchemy version requirement needs to be increased from 1.4.17 to at least 1.4.29.
For my example code above I was using:
sqlmodel==0.0.8 SQLAlchemy==1.4.27
The following error was returned:
INFO - Traceback (most recent call last): INFO - File "/tmp/venvn6sl_gkl/script.py", line 44, in
INFO - res = test_sqlmodel(*arg_dict["args"], **arg_dict["kwargs"]) INFO - File "/tmp/venvn6sl_gkl/script.py", line 42, in test_sqlmodel INFO - session.get(Hero, 1) INFO - File "/tmp/venvn6sl_gkl/lib/python3.8/site-packages/sqlmodel/orm/session.py", line 133, in get INFO - return super().get( INFO - TypeError: get() got an unexpected keyword argument 'execution_options'
Operating System
Linux
Operating System Details
No response
SQLModel Version
0.0.8
Python Version
3.8
Additional Context
No response
SQLAlchemy is now pretty out of date, with several releases since. However, I do see 1.4.41 installed with 0.0.8, so maybe this can be closed out?
https://github.com/tiangolo/sqlmodel/blob/main/pyproject.toml#L34
Thanks! This was handled in https://github.com/tiangolo/sqlmodel/pull/439, it will be available in the next version, 0.0.9. 🎉
Is 0.0.9 coming soon? 0.0.8 locks SQLAlchemy to a specific patch release, but the later patch releases have bug fixes that I need (version locking fixed in #519).