Skip to main content

A ConnectionFactory for use by psycopg2 to enable SSH Tunneling

Project description

PsycoSSH

A ConnectionFactory for use by psycopg2 to enable SSH Tunneling

Probably should just use create_tunneled_engine which wraps around it

Example

from psycossh import create_tunneled_engine
from sqlalchemy import MetaData

engine = create_tunneled_engine(
    ssh_user="ssh_username",
    ssh_pkey=r"C:\Path\To\OpenSSH_Private_Key",  # without password
    ssh_host=r"ssh_server_host",
    ssh_port=22,  # default value  

    database=r"main_db",
    pg_host="localhost",  # default value
    pg_port=5432,  # default value
    pg_password="pg_password"
)
meta = MetaData()
meta.reflect(bind=engine)
print(meta.tables)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

psycossh-0.0.1.tar.gz (2.8 kB view hashes)

Uploaded Source

Built Distribution

psycossh-0.0.1-py3-none-any.whl (5.7 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page