Skip to content
This repository was archived by the owner on Sep 23, 2024. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 16 additions & 5 deletions tap_postgres/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,20 @@ def do_sync_full_table(conn_config, stream, state, desired_columns, md_map):
"""
LOGGER.info("Stream %s is using full_table replication", stream['tap_stream_id'])
sync_common.send_schema_message(stream, [])
if md_map.get((), {}).get('is-view'):
state = full_table.sync_view(conn_config, stream, state, desired_columns, md_map)
else:
state = full_table.sync_table(conn_config, stream, state, desired_columns, md_map)
return state
attempt = 0
while True:
try:
if md_map.get((), {}).get('is-view'):
state = full_table.sync_view(conn_config, stream, state, desired_columns, md_map)
else:
state = full_table.sync_table(conn_config, stream, state, desired_columns, md_map)
return state
except Exception as e:
LOGGER.warn("error on read for a stream: %s. Message: %s", stream['tap_stream_id'], e)
if attempt > post_db.TRY_NUMBER:
raise e
else:
attempt = attempt + 1


# Possible state keys: replication_key, replication_key_value, version
Expand Down Expand Up @@ -411,6 +420,8 @@ def main_impl():
conn_config['sslmode'] = 'require'

post_db.CURSOR_ITER_SIZE = int(args.config.get('itersize', post_db.CURSOR_ITER_SIZE))
post_db.TRY_NUMBER = int(args.config.get('trynumber', post_db.TRY_NUMBER))


if args.discover:
do_discovery(conn_config)
Expand Down
1 change: 1 addition & 0 deletions tap_postgres/db.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
LOGGER = singer.get_logger('tap_postgres')

CURSOR_ITER_SIZE = 20000
TRY_NUMBER = 10


# pylint: disable=invalid-name,missing-function-docstring
Expand Down