| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 2ecc862 commit 4ac8714
2 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -95,7 +95,8 @@ def exec( | |||
| 95 | 95 | ```Python | |
| 96 | 96 | heroes = session.exec(select(Hero)).all() | |
| 97 | 97 | ``` | |
| 98 | - """ | ||
| 98 | + """, | ||
| 99 | + category=None, | ||
| 99 | 100 | ) | |
| 100 | 101 | def execute( # type: ignore | |
| 101 | 102 | self, | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -3,7 +3,7 @@ | |||
| 3 | 3 | import pytest | |
| 4 | 4 | from sqlalchemy.exc import IntegrityError | |
| 5 | 5 | 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 | ||
| 7 | 7 | ||
| 8 | 8 | ||
| 9 | 9 | def test_should_allow_duplicate_row_if_unique_constraint_is_not_passed(clear_sqlmodel): | |
@@ -31,7 +31,7 @@ class Hero(SQLModel, table=True): | |||
| 31 | 31 | session.refresh(hero_2) | |
| 32 | 32 | ||
| 33 | 33 | with Session(engine) as session: | |
| 34 | - heroes = session.query(Hero).all() | ||
| 34 | + heroes = session.exec(select(Hero)).all() | ||
| 35 | 35 | assert len(heroes) == 2 | |
| 36 | 36 | assert heroes[0].name == heroes[1].name | |
| 37 | 37 | ||
@@ -61,7 +61,7 @@ class Hero(SQLModel, table=True): | |||
| 61 | 61 | session.refresh(hero_2) | |
| 62 | 62 | ||
| 63 | 63 | with Session(engine) as session: | |
| 64 | - heroes = session.query(Hero).all() | ||
| 64 | + heroes = session.exec(select(Hero)).all() | ||
| 65 | 65 | assert len(heroes) == 2 | |
| 66 | 66 | assert heroes[0].name == heroes[1].name | |
| 67 | 67 | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments