This repository has been archived by the owner on Sep 23, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 100
Add replica option #131
Closed
Closed
Add replica option #131
Changes from 1 commit
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
f8b4440
Fixes https://github.com/transferwise/pipelinewise-tap-postgres/issue…
deanmorin 992d705
Enable traditional streams to extract from replica instance
mvgijssel a073f5c
Don't process views
mvgijssel acd0b0f
Output partial schema and record when TOAST columns are missing
mvgijssel File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -38,14 +38,27 @@ def fully_qualified_table_name(schema, table): | |
return '"{}"."{}"'.format(canonicalize_identifier(schema), canonicalize_identifier(table)) | ||
|
||
|
||
def open_connection(conn_config, logical_replication=False): | ||
def open_connection(conn_config, logical_replication=False, primary_connection=False): | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe use There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah I think that's a good idea! |
||
if not primary_connection and conn_config['use_replica']: | ||
host_key = "replica_host" | ||
dbname_key = "replica_dbname" | ||
user_key = "replica_user" | ||
password_key = "replica_password" | ||
port_key = "replica_port" | ||
else: | ||
host_key = "host" | ||
dbname_key = "dbname" | ||
user_key = "user" | ||
password_key = "password" | ||
port_key = "port" | ||
|
||
cfg = { | ||
'application_name': 'pipelinewise', | ||
'host': conn_config['host'], | ||
'dbname': conn_config['dbname'], | ||
'user': conn_config['user'], | ||
'password': conn_config['password'], | ||
'port': conn_config['port'], | ||
'host': conn_config[host_key], | ||
'dbname': conn_config[dbname_key], | ||
'user': conn_config[user_key], | ||
'password': conn_config[password_key], | ||
'port': conn_config[port_key], | ||
'connect_timeout': 30 | ||
} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could these not default to the same credentials as the primary? Similar to: https://github.com/transferwise/pipelinewise/blob/206e75e630933d1a2b2ab9afb36261a55ccf0e4c/pipelinewise/fastsync/commons/tap_postgres.py#L161-L164
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah I think that would be a great default!