I am having serious issues setting up a proper tunnel in paramiko to enable a database connection. I have reviewed the example \'forward.py\', but am not understanding how
if you have created your ssh tunnel using the forward.py script ; you can use the ssh tunnel to connect to postgresql like this:
conn = psycopg2.connect(database="test", host="localhost", port=<forward_port>)
I had same serious issues getting paramiko to work too but ended up doing it with another library (sshtunnel) that wraps and simplifies paramiko's tunneling.
You can check my answer in another similar question with some sample code to use it.