@@ -165,18 +165,33 @@ def sqlalchemy_get_pool(pool_size: int, pool_recycle_time_seconds: int) -> sqlal
165165 'pool_timeout' : 0 , # seconds
166166 'pool_recycle' : pool_recycle_time_seconds , # seconds
167167 }
168+ is_test_db = config .postgres_password == 'postgres'
169+
170+ if is_test_db :
171+ # TODO fix
172+ pool = sqlalchemy .create_engine (
173+ sqlalchemy .engine .url .URL .create (
174+ 'postgresql+pg8000' ,
175+ username = config .postgres_user ,
176+ host = config .postgres_host ,
177+ port = config .postgres_port ,
178+ password = config .postgres_password ,
179+ database = config .postgres_db ,
180+ ),
181+ ** db_config ,
182+ )
183+ else :
184+ pool = sqlalchemy .create_engine (
185+ sqlalchemy .engine .url .URL .create (
186+ 'postgresql+pg8000' ,
187+ username = config .postgres_user ,
188+ password = config .postgres_password ,
189+ database = config .postgres_db ,
190+ query = {'unix_sock' : '{}/.s.PGSQL.5432' .format (config .postgres_host )},
191+ ),
192+ ** db_config ,
193+ )
168194
169- pool = sqlalchemy .create_engine (
170- sqlalchemy .engine .url .URL .create (
171- 'postgresql+pg8000' ,
172- username = config .postgres_user ,
173- host = config .postgres_host ,
174- port = config .postgres_port ,
175- password = config .postgres_password ,
176- database = config .postgres_db ,
177- ),
178- ** db_config ,
179- )
180195 pool .dialect .description_encoding = None
181196
182197 return pool
0 commit comments