Update libs; Removed support PostgreSQL 13

This commit is contained in:
Eugene Morozov
2024-05-28 10:59:02 +03:00
parent 95ec028bf4
commit 1d01dfe84d
12 changed files with 79 additions and 114 deletions

View File

@@ -64,9 +64,7 @@ def backup_db_from_postgres(file_path: str) -> bool:
:param file:
:return:
"""
postgres_connection_url = (
f"postgresql://{DB_USER}:{DB_PASSWORD}@{DB_HOST}:{DB_PORT}/{DB_NAME}"
)
postgres_connection_url = f"postgresql://{DB_USER}:{DB_PASSWORD}@{DB_HOST}:{DB_PORT}/{DB_NAME}"
try:
process = subprocess.Popen(
[
@@ -91,9 +89,7 @@ def backup_db_from_postgres(file_path: str) -> bool:
def compress_file_to_xz(file_path: str) -> str:
compressed_file_path = f"{file_path}.xz"
with open(file_path, "rb") as origin_file:
with lzma.open(
compressed_file_path, "wb", filters=COMPRESSION_SETTINGS
) as compressed_file:
with lzma.open(compressed_file_path, "wb", filters=COMPRESSION_SETTINGS) as compressed_file:
shutil.copyfileobj(origin_file, compressed_file)
os.remove(file_path)
return compressed_file_path