So, I am using Windows to connect to remote Postgres database with a tool like Navicat. I am trying to achieve the same thing using Python (2.7) and SQLAlchemy (0.9) but with no success.
So, my Navicat setup looks like this:
I tried to set up tunnels in PuTTY, connect to server, leave connection opened and experimenting with IPs and ports but with no success at all. I'm not sure if all that's enough since I have this public key and passphrase, so I wonder is it possible to connect to this database from Windows machine using Python and SQLAlchemy (and this beautiful PuTTY app also, of course) in any way?
Thanks!
You can pass the server and port to your create_engine() statement, ala:
create_engine('postgres://username:password@server:port/database')
http://docs.sqlalchemy.org/en/rel_0_9/dialects/postgresql.html
So assuming you've FIRST established an SSH tunnel to the remote host, and port forwarded local port 1111 to the remote server's port 5432 (which is the default postgres port), your connect string would be something like:
create_engine('postgres://username:password@localhost:1111/database')
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With