Skip to content

Commit

Permalink
Change engine to a depend as recommended by @Vebop
Browse files Browse the repository at this point in the history
  • Loading branch information
bbrondel committed Jan 23, 2025
1 parent 33d3225 commit 6525ce9
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions python/lsst/consdb/dependencies.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,10 @@
import logging
from typing import Annotated

from fastapi import Path, Request
from fastapi import Depends, Path, Request
from pydantic import AfterValidator
from sqlalchemy import create_engine, inspect
from sqlalchemy.engine import Engine
from sqlalchemy.orm import sessionmaker

from .cdb_schema import InstrumentTable
Expand Down Expand Up @@ -78,7 +79,7 @@ def get_logger(request: Request):
instrument_list: list[str] | None = None


def get_instrument_table(instrument: str):
def get_instrument_table(instrument: str, engine: Engine = Depends(get_engine)):
global instrument_list
global instrument_tables

Expand Down

0 comments on commit 6525ce9

Please sign in to comment.