Zoom Logo

Autobots - Speaker view
Daniel Floyd
40:58
https://docs.sqlalchemy.org/en/14/core/engines.html
Daniel Floyd
43:26
https://docs.sqlalchemy.org/en/14/orm/mapping_styles.html#declarative-mapping
Daniel Floyd
53:15
https://fastapi.tiangolo.com/tutorial/sql-databases/#use-pydantics-orm_mode
Daniel Floyd
01:25:48
https://httpstatuses.com/
Daniel Floyd
01:56:02
https://sqlmodel.tiangolo.com/tutorial/fastapi/tests/#memory-database
Daniel Floyd
02:05:45
engine = create_engine("sqlite://", connect_args={"check_same_thread": False}, poolclass=StaticPool)
Daniel Floyd
02:07:54
@pytest.fixture(name="session")def session_fixture():engine = create_engine("sqlite://", connect_args={"check_same_thread": False}, poolclass=StaticPool)models.Base.metadata.create_all(bind=engine)with Session(engine) as session:yield session
Daniel Floyd
02:16:25
import pytestfrom sqlalchemy import create_enginefrom sqlalchemy.orm import Sessionfrom sqlalchemy.pool import StaticPoolfrom fastapi.testclient import TestClientfrom app import modelsfrom app.database import get_dbfrom app.main import app@pytest.fixture(name="session")def session_fixture():engine = create_engine("sqlite://", connect_args={"check_same_thread": False}, poolclass=StaticPool)models.Base.metadata.create_all(bind=engine)with Session(engine) as session:yield session@pytest.fixture(name="client")def client_fixture(session: Session):def get_session_override():return sessionapp.dependency_overrides[get_db] = get_session_overrideclient = TestClient(app)yield clientapp.dependency_overrides.clear()