justinbchau / custom-elt-project

79 stars 44 forks source link

error: aborting because of server version mismatch #2

Open chpagy opened 3 months ago

chpagy commented 3 months ago

elt_script-1 | pg_dump: error: aborting because of server version mismatch elt_script-1 | pg_dump: detail: server version: 16.2 (Debian 16.2-1.pgdg120+2); pg_dump version: 15.6 (Debian 15.6-0+deb12u1) elt_script-1 | Error connecting to PostgreSQL: Command '['pg_isready', '-h', 'source_postgres']' returned non-zero exit status 2. elt_script-1 | Retrying in 5 seconds... (Attempt 1/5) elt_script-1 | Error connecting to PostgreSQL: Command '['pg_isready', '-h', 'source_postgres']' returned non-zero exit status 2. elt_script-1 | Retrying in 5 seconds... (Attempt 2/5) elt_script-1 | Successfully connected to PostgreSQL! elt_script-1 | Starting ELT script... elt_script-1 | Traceback (most recent call last): elt_script-1 | File "elt_script.py", line 63, in elt_script-1 | subprocess.run(dump_command, env=subprocess_env, check=True) elt_script-1 | File "/usr/local/lib/python3.8/subprocess.py", line 516, in run elt_script-1 | raise CalledProcessError(retcode, process.args, elt_script-1 | subprocess.CalledProcessError: Command '['pg_dump', '-h', 'source_postgres', '-U', 'postgres', '-d', 'source_db', '-f', 'data_dump.sql', '-w']' returned non-zero exit status 1. elt_script-1 exited with code 1

amaboh commented 3 months ago

There is a version Mismatch of your elt_script.py likely installed within your elt_script-1 container is using the pg_dump utility, which is version 15.6.

However, your source_postgres database server is a newer version (16.2).

as a result this version difference is causing pg_dump to fail as it's not fully compatible with the newer database server.

Solution: Upgrade pg_dump Inside Your Container:

Modify Dockerfile: Edit the Dockerfile used to build your elt_script-1 container. Install Newer Version: Ensure it installs a pg_dump version matching or exceeding your source_postgres version (16.2). Rebuild Image: Rebuild the container image after making the change. let me know if this works

apoorva-saxena commented 2 months ago

This pr fixes the issue: https://github.com/justinbchau/custom-elt-project/pull/3/files