Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Log Based Replication not working with SSH Tunnel #469

Open
axel-lcdp opened this issue Jul 24, 2024 · 2 comments
Open

Log Based Replication not working with SSH Tunnel #469

axel-lcdp opened this issue Jul 24, 2024 · 2 comments

Comments

@axel-lcdp
Copy link

When using SSH Tunnel, we cannot replicate tables using logicial LogBased Replication.

The function responsible for the replication is in tap_postgres/client.py > logical_replication_connection line 520.

The connection is using the raw config to connect to the database, however, it should be using the SQLAlchemy URL because it has been modified to handle the new host and port through the SSH tunnel (in the file tap_postgres/tap.py line 427).

@visch
Copy link
Member

visch commented Jul 24, 2024

@axel-lcdp thank you for this issue!

@axel-lcdp yes you're right this function needs updating

def logical_replication_connection(self):
"""A logical replication connection to the database.
Uses a direct psycopg2 implementation rather than through sqlalchemy.
"""
connection_string = (
f"dbname={self.config['database']} user={self.config['user']} password="
f"{self.config['password']} host={self.config['host']} port="
f"{self.config['port']}"
)
return psycopg2.connect(
connection_string,
application_name="tap_postgres",
connection_factory=extras.LogicalReplicationConnection,
)

We'll take PRs. I'm surprised we missed this during our testing!

@axel-lcdp
Copy link
Author

No problem ! I will see what I can do.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: No status
Development

No branches or pull requests

2 participants