I think do not understand properly how does sqlalchemy works, I have tried to connect to postgresql running on some cloud server from my local computer:
db = create_engine('postgresql://[email protected]:5432/dbname')
but that causes the error:
Is the server running on host "172.23.160.212" and accepting
TCP/IP connections on port 5432?
I have checked the port and host also exists.
I thought I should connect to the host using ssh first:
with SSHTunnelForwarder((172.23.160.212, 22), ssh_username='ubuntu', remote_bind_address=(127.0.0.1, 3306)) as server:
db = create_engine('postgresql://[email protected]:5432/dbname')
But that did not help.