Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
hadrien committed Apr 6, 2021
1 parent 455b5f1 commit a363f86
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions fastapi_sqla/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@
from functools import singledispatch
from typing import Callable, Generic, List, TypeVar, Union

import sqlalchemy as sa
import structlog
from fastapi import Depends, FastAPI, Query, Request
from fastapi.concurrency import contextmanager_in_threadpool
from pydantic import BaseModel, Field
from pydantic.generics import GenericModel
from sqlalchemy import engine_from_config
from sqlalchemy.ext.declarative import DeferredReflection, declarative_base
from sqlalchemy.orm import Query as LegacyQuery
from sqlalchemy.orm.session import Session as SqlaSession
Expand All @@ -32,7 +32,7 @@ def setup(app: FastAPI):


def startup():
engine = sa.engine_from_config(os.environ, prefix="sqlalchemy_")
engine = engine_from_config(os.environ, prefix="sqlalchemy_")
Base.metadata.bind = engine
Base.prepare(engine)
_Session.configure(bind=engine)
Expand Down
2 changes: 1 addition & 1 deletion fastapi_sqla/_pytest_plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ def sqla_reflection(sqla_modules, sqla_connection, db_url):
@fixture(autouse=True)
def patch_sessionmaker(db_url, sqla_connection, sqla_transaction):
"""So that all DB operations are never written to db for real."""
with patch("fastapi_sqla.sa.engine_from_config") as engine_from_config:
with patch("fastapi_sqla.engine_from_config") as engine_from_config:
engine_from_config.return_value = sqla_connection
yield engine_from_config

Expand Down

0 comments on commit a363f86

Please sign in to comment.