Skip to content
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

SQLAlchemy Minimum Version Requirement at least 1.4.29 #434

Open
8 tasks done
JoshGooch opened this issue Sep 4, 2022 · 3 comments
Open
8 tasks done

SQLAlchemy Minimum Version Requirement at least 1.4.29 #434

JoshGooch opened this issue Sep 4, 2022 · 3 comments
Labels
question Further information is requested

Comments

@JoshGooch
Copy link

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

@gitpushdashf
Copy link

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

tiangolo added a commit that referenced this issue Oct 23, 2023
#434) (#439)

Co-authored-by: Sebastián Ramírez <tiangolo@gmail.com>
@tiangolo
Copy link
Member

Thanks! This was handled in #439, it will be available in the next version, 0.0.9. 🎉

@jpmckinney
Copy link

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).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

4 participants