dbt-sqlserver
dbt-sqlserver copied to clipboard
feat: adding support for bastion / jumpbox support
Objective
The PR aims at adding supports for Jump / Bastions servers to the connector so that connecting to a server behind a VPN would be possible.
Proposed modifications
- The code modifies the way the connection is opened by the adapter.
- If provided with
ssh_tunnel_host,ssh_tunnel_port,ssh_tunnel_usernameand one of eitherssh_tunnel_passwordorssh_tunnel_ssh_key_path, the adapter first establishes asshtunnelto the jump host before connecting to the server. - The code uses
sshtunnelto handles the tunnel creation. - A dataclass is introduced to bind the
pyodbc.Connection.closemethod to theSSHTunnelForwarder.closemethod. - The dataclass is preferred over registering a callback in
pyodbcsincepyodbc.closeattribute is not settable.
Should be rebased on current master so that there are no formatting changes anymore
@sdebruyn Hi,
I have just pushed a commits with everything rebased on master.
hj
I'm not sure support for SSH tunneling should be a feature of this adapter that we would want to maintain, as well as an extra dependency that would not be needed for 99% of the users. Closing this for now.