This commit is contained in:
2026-05-16 02:14:57 +03:00
parent 91a5283a2f
commit 88e4ab62be
2 changed files with 39 additions and 27 deletions

View File

@@ -12,7 +12,13 @@ postgres_pool = pool.ThreadedConnectionPool(1, 10, dsn=DATABASE_URL)
def get_db_connection():
"""Return a connection from the pool. Caller must close it after use."""
return postgres_pool.getconn()
conn = postgres_pool.getconn()
# Устанавливаем схему automarket (таблицы созданы там, а не в public)
cur = conn.cursor()
cur.execute("SET search_path TO automarket, public")
cur.close()
conn.commit()
return conn
def release_db_connection(conn):
"""Return the connection to the pool."""