Skip to content

Commit 4ac8714

Browse files
authored
🔇 Do not raise deprecation warnings for execute as it's automatically used internally (#716)
* 🔇 Do not raise deprecation warnings for execute as it's automatically used internally * ✅ Tweak tests to not use deprecated query
1 parent 2ecc862 commit 4ac8714

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

‎sqlmodel/orm/session.py‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,8 @@ def exec(
9595
```Python
9696
heroes = session.exec(select(Hero)).all()
9797
```
98-
"""
98+
""",
99+
category=None,
99100
)
100101
def execute( # type: ignore
101102
self,

‎tests/test_main.py‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import pytest
44
from sqlalchemy.exc import IntegrityError
55
from sqlalchemy.orm import RelationshipProperty
6-
from sqlmodel import Field, Relationship, Session, SQLModel, create_engine
6+
from sqlmodel import Field, Relationship, Session, SQLModel, create_engine, select
77

88

99
def test_should_allow_duplicate_row_if_unique_constraint_is_not_passed(clear_sqlmodel):
@@ -31,7 +31,7 @@ class Hero(SQLModel, table=True):
3131
session.refresh(hero_2)
3232

3333
with Session(engine) as session:
34-
heroes = session.query(Hero).all()
34+
heroes = session.exec(select(Hero)).all()
3535
assert len(heroes) == 2
3636
assert heroes[0].name == heroes[1].name
3737

@@ -61,7 +61,7 @@ class Hero(SQLModel, table=True):
6161
session.refresh(hero_2)
6262

6363
with Session(engine) as session:
64-
heroes = session.query(Hero).all()
64+
heroes = session.exec(select(Hero)).all()
6565
assert len(heroes) == 2
6666
assert heroes[0].name == heroes[1].name
6767

0 commit comments

Comments
 (0)