From 791530b28aae6fb7cd6872061359c8bbbed88727 Mon Sep 17 00:00:00 2001 From: mst Date: Wed, 19 Mar 2025 13:36:44 +0300 Subject: [PATCH] add host to pg_dump and pg_restore --- functions.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/functions.py b/functions.py index f598afa..07f769a 100644 --- a/functions.py +++ b/functions.py @@ -698,7 +698,7 @@ def createExport() -> dict: # Export database to SQL file dump_file = temp_dir / 'database.sql' result = subprocess.Popen( - f'pg_dump -U {dbUser} -d {dbName} -F c -E UTF8 -f {dump_file}', + f'pg_dump -h {dbHost} -U {dbUser} -d {dbName} -F c -E UTF8 -f {dump_file}', stdin=subprocess.PIPE, shell=True, stdout=subprocess.PIPE, @@ -706,6 +706,7 @@ def createExport() -> dict: encoding="utf-8", env=dict(os.environ, PGPASSWORD=dbPass) ) + # absolutely dumb workaround for an error time.sleep(1) @@ -771,7 +772,7 @@ def importData(export_file) -> dict: dump_file = const.tempDir / 'database.sql' process = subprocess.Popen( - f'pg_restore --clean -U {dbUser} -d {dbName} {dump_file}', + f'pg_restore -h {dbHost} --clean -U {dbUser} -d {dbName} {dump_file}', shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE,