Home > OS >  Trying to Connect Python With a PostgreSQL DB with SSH Tunnel
Trying to Connect Python With a PostgreSQL DB with SSH Tunnel

Time:06-30

I'm trying to connect my script to a PostgreSQL database via sshtunnel and psycopg2. I can access the DB with my credentials through DBeaver. So, basically I have this:

SSH Configuration

Where the SSH paramateres are similar to this:

Host/IP: 'someproxy.something.io'
User Name: 'User1'
Private key: Path to an id_rsa file
Passphrase: 'Password1'

This is my code:

try:

    print('Connecting to the postgre database...')

   

    with SSHTunnelForwarder(

            "someproxy.something.io",

            ssh_username = "User1",

            ssh_private_key = "C:/~ /.ssh/User1_id_rsa",

            ssh_private_key_password = "Password1",

            remote_bind_adress = ("mydatabase-postgres.something.io", 5432)

    ) as server:

        server.start()

And I'm getting this error:

ValueError: Unknown arguments: {'remote_bind_adress': ('mydatabase-postgres.something.io', 5432)}

CodePudding user response:

You have a typo in the parameter name: remote_bind_adress -> remote_bind_address.

  • Related