Yaron Levi
04/21/2024, 6:38 PMpg_dump
to take a snapshot of a postgres database but having hard time installing pg_dump
We’ve tried this inside the flow’s code:
@flow(name="dump_postgres_to_s3", log_prints=True)
def dump_postgres_to_s3(connection_string: str):
result = subprocess.run(['apt-get', 'install', 'pg_dump'], stdout=subprocess.PIPE)
print(result)
But the result is an error code 100:
CompletedProcess(args=['apt-get', '--fix-broken', 'install', 'pg_dump'], returncode=100, stdout=b'Reading package lists...\nBuilding dependency tree...\nReading state information...\n')
From research, it looks like error code 100 means the is not available to be installed.
So any idea how we can get pg_dump installed and used inside a Flow?
Just to clarify: this runs inside an AWS ECS Task, which uses the default Prefect image <http://docker.io/prefecthq/prefect:2.13.5-python3.10|docker.io/prefecthq/prefect:2.13.5-python3.10>
Thank you for any help on this 🙂Yaron Levi
04/24/2024, 9:15 AMFROM prefecthq/prefect:2.18.0-python3.10
RUN apt-get update && apt-get install --no-install-recommends --no-upgrade -y postgresql-client