Commit 752f511 1 parent e0b33e9 commit 752f511 Copy full SHA for 752f511
File tree 2 files changed +9
-8
lines changed
2 files changed +9
-8
lines changed Original file line number Diff line number Diff line change 5
5
from sqlalchemy .orm import Session
6
6
7
7
from application .settings import get_settings
8
+ import logging
9
+
10
+ logger = logging .getLogger (__name__ )
8
11
9
12
10
13
# this can be used in fast api path functions using Depends to inject a db session
11
14
def get_session () -> Iterator [Session ]:
15
+ logger .info (
16
+ f"Database engine created with pool_size={ get_settings ().DB_POOL_SIZE } , "
17
+ f"max_overflow={ get_settings ().DB_POOL_MAX_OVERFLOW } "
18
+ )
12
19
yield from _get_fastapi_sessionmaker ().get_db ()
13
20
14
21
Original file line number Diff line number Diff line change @@ -65,14 +65,8 @@ def run_migrations_online():
65
65
url = config .get_main_option ("sqlalchemy.url" )
66
66
else :
67
67
url = get_settings ().WRITE_DATABASE_URL
68
- engine = create_engine (
69
- url ,
70
- pool_size = get_settings ().DB_POOL_SIZE ,
71
- max_overflow = get_settings ().DB_POOL_MAX_OVERFLOW ,
72
- )
73
- logging .info (
74
- f"Connection Pool: pool_size={ engine .pool .size ()} , max_overflow={ engine .pool ._max_overflow } "
75
- )
68
+
69
+ engine = create_engine (url )
76
70
connectable = engine
77
71
78
72
with connectable .connect () as connection :
You can’t perform that action at this time.
0 commit comments