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

FastSync with tap_postgres fails to set last_replication_method key in state bookmarks #577

Closed
rscheuermann opened this issue Nov 22, 2020 · 3 comments
Labels
bug Something isn't working

Comments

@rscheuermann
Copy link

rscheuermann commented Nov 22, 2020

Describe the bug
After running a complete tap (tap-postgres to target-snowflake) using only FastSync for the initial load, my state file contains bookmarks that look like this:

"public-file_widgets": {
      "lsn": 129769327017984,
      "version": 1
    }

Once complete, and I try to run the tap using the singer method, I get an error:

Traceback (most recent call last):
  File "/app/.virtualenvs/tap-postgres/bin/tap-postgres", line 8, in <module>
    sys.exit(main())
  File "/app/.virtualenvs/tap-postgres/lib/python3.7/site-packages/tap_postgres/__init__.py", line 434, in main
    raise exc
  File "/app/.virtualenvs/tap-postgres/lib/python3.7/site-packages/tap_postgres/__init__.py", line 431, in main
    main_impl()
  File "/app/.virtualenvs/tap-postgres/lib/python3.7/site-packages/tap_postgres/__init__.py", line 421, in main_impl
    args.config.get('default_replication_method'), state, state_file)
  File "/app/.virtualenvs/tap-postgres/lib/python3.7/site-packages/tap_postgres/__init__.py", line 321, in do_sync
    state = sync_logical_streams(conn_config, list(streams), state, end_lsn, state_file)
  File "/app/.virtualenvs/tap-postgres/lib/python3.7/site-packages/tap_postgres/__init__.py", line 216, in sync_logical_streams
    if bookmark == {} or bookmark['last_replication_method'] != 'LOG_BASED' or stream in selected_streams:
KeyError: 'last_replication_method'

The code is looking for last_replication_method on a bookmark object, but fastsync isn't setting it. See:

return {
'lsn': lsn,
'version': 1
}

To resolve, I added last_replication_method manually to my state file.

@rscheuermann rscheuermann added the bug Something isn't working label Nov 22, 2020
@Samira-El
Copy link
Contributor

Samira-El commented Jan 21, 2021

Hey Ryan,

Is this still happening? If no, then can I ask you to close this issue, otherwise, please elaborate a bit more on:

using only FastSync

How did you trigger fastSync? was it via the pipelinewise sync_tables command or running the postgres-to-snowflake cli?

public-file_widgets

What replication method have you configured for this table?

@rscheuermann
Copy link
Author

I'm no longer able to replicate this issue.

@halilduygulu
Copy link

this is still like that in master https://github.com/transferwise/pipelinewise/blob/master/pipelinewise/fastsync/commons/tap_postgres.py#L327

and I am getting error in second run when singer tries to read state
#990

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants