-
-
Notifications
You must be signed in to change notification settings - Fork 770
Description
First Check
- I added a very descriptive title to this issue.
- I used the GitHub search to find a similar issue and didn't find it.
- I searched the SQLModel documentation, with the integrated search.
- I already searched in Google "How to X in SQLModel" and didn't find any information.
- I already read and followed all the tutorial in the docs and didn't find an answer.
- I already checked if it is not related to SQLModel but to Pydantic.
- I already checked if it is not related to SQLModel but to SQLAlchemy.
Commit to Help
- 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