🔇 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
This commit is contained in:
Sebastián Ramírez 2023-11-30 16:23:06 +01:00 committed by GitHub
parent 2ecc86275f
commit 4ac87146b1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 4 deletions

View File

@ -95,7 +95,8 @@ class Session(_Session):
```Python
heroes = session.exec(select(Hero)).all()
```
"""
""",
category=None,
)
def execute( # type: ignore
self,

View File

@ -3,7 +3,7 @@ from typing import List, Optional
import pytest
from sqlalchemy.exc import IntegrityError
from sqlalchemy.orm import RelationshipProperty
from sqlmodel import Field, Relationship, Session, SQLModel, create_engine
from sqlmodel import Field, Relationship, Session, SQLModel, create_engine, select
def test_should_allow_duplicate_row_if_unique_constraint_is_not_passed(clear_sqlmodel):
@ -31,7 +31,7 @@ def test_should_allow_duplicate_row_if_unique_constraint_is_not_passed(clear_sql
session.refresh(hero_2)
with Session(engine) as session:
heroes = session.query(Hero).all()
heroes = session.exec(select(Hero)).all()
assert len(heroes) == 2
assert heroes[0].name == heroes[1].name
@ -61,7 +61,7 @@ def test_should_allow_duplicate_row_if_unique_constraint_is_false(clear_sqlmodel
session.refresh(hero_2)
with Session(engine) as session:
heroes = session.query(Hero).all()
heroes = session.exec(select(Hero)).all()
assert len(heroes) == 2
assert heroes[0].name == heroes[1].name