File tree Expand file tree Collapse file tree 2 files changed +12
-3
lines changed
Expand file tree Collapse file tree 2 files changed +12
-3
lines changed Original file line number Diff line number Diff line change @@ -43,8 +43,17 @@ def get_synchronous_db() -> Iterator[Session]:
4343 if SessionLocal is None :
4444 # Create a synchronous database URL using psycopg2 instead of asyncpg
4545 # asyncpg only works with async engines, not synchronous ones
46- db_url = GLOBALS .database_config .url
47- sync_url = db_url .set (drivername = "postgresql+psycopg2" )
46+ from sqlalchemy .engine .url import URL
47+
48+ db_config = GLOBALS .database_config
49+ sync_url = URL (
50+ drivername = "postgresql+psycopg2" ,
51+ username = db_config .username ,
52+ password = str (db_config .password ) if db_config .password else None ,
53+ host = db_config .host ,
54+ port = db_config .port ,
55+ database = db_config .database ,
56+ )
4857 engine = create_engine (sync_url , pool_size = 5 , max_overflow = 0 )
4958 SessionLocal = sessionmaker (autocommit = False , autoflush = False , bind = engine )
5059
Original file line number Diff line number Diff line change @@ -45,7 +45,7 @@ services:
4545 networks :
4646 - gfw-tile-cache_test_default
4747 ports :
48- - " 54322 :5432"
48+ - " 54321 :5432"
4949 environment :
5050 - POSTGRES_PORT=5432
5151 - POSTGRES_DB=_test
You can’t perform that action at this time.
0 commit comments