Skip to content

Commit

Permalink
Merge pull request #89 from ecmwf-projects/use-catalogue-engine-def
Browse files Browse the repository at this point in the history
Use engine definition from cads-catalogue
  • Loading branch information
keul authored Oct 15, 2024
2 parents 237e1ee + 17d5929 commit 462fca7
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion cads_catalogue_api_service/fastapisessionmaker.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
from collections.abc import Iterator
from contextlib import contextmanager

import cads_catalogue
import sqlalchemy as sa
from sqlalchemy.orm import Session

Expand Down Expand Up @@ -110,7 +111,7 @@ def get_engine(uri: str) -> sa.engine.Engine:
This function may be updated over time to reflect recommended engine configuration
for use with FastAPI.
"""
return sa.create_engine(uri, pool_pre_ping=True)
return cads_catalogue.database.ensure_engine(uri)


def get_sessionmaker_for_engine(engine: sa.engine.Engine) -> sa.orm.sessionmaker:
Expand Down

0 comments on commit 462fca7

Please sign in to comment.