singer-io / tap-typeform

Singer.io tap for extracting TypeForm data
GNU Affero General Public License v3.0
11 stars 20 forks source link

Fix bookmarking #16

Closed kingfink closed 4 years ago

kingfink commented 4 years ago

Description of change

Updated the bookmarked date for TypeForm so that recent responses are captured without requiring a full resync.

Also made an update so that the default end date will not be in the past.

Manual QA steps

First, I ran the existing tap:

$ pip install tap-typeform

$ pip install https://github.com/chrisgoddard/singer-discover/archive/master.zip

$ cat config.json

{
  "token": "<redacted>",
  "start_date": "2019-12-05T00:00:00Z",
  "forms": "ZjsA3Q",
  "incremental_range": "daily"
}

$ tap-typeform --config config.json --discover | singer-discover -o catalog.json

$ tap-typeform --config config.json --properties catalog.json

INFO --------------------
INFO landings: 1
INFO answers: 12
INFO questions: 15
INFO --------------------

I saved the output STATE message:

$ echo '{"bookmarks": {"ZjsA3Q": {"date_to_resume": "2019-12-13 00:00:00"}}}' > state.json

Then, I submitted a new form response on 12/12 at 18:35 UTC and tried to pick-up where I left off based on that state.json and no results were returned.

$ tap-typeform --config config.json --properties catalog.json --state state.json

INFO --------------------
INFO landings: 0
INFO answers: 0
INFO questions: 15
INFO --------------------

Now, trying with this fork:

$ pip install https://github.com/kingfink/tap-typeform/archive/master.zip

$ tap-typeform --config config.json --properties catalog.json

INFO --------------------
INFO landings: 2
INFO answers: 25
INFO questions: 15
INFO --------------------

I saved the output of the new STATE message and then submitted another new response on 12/12.

$ echo '{"bookmarks": {"ZjsA3Q": {"date_to_resume": "2019-12-12 00:00:00"}}}' > state.json

Running again and successfully getting the new response:

$ tap-typeform --config config.json --properties catalog.json --state state.json

INFO --------------------
INFO landings: 3
INFO answers: 37
INFO questions: 15
INFO --------------------

Finally, testing along with target-csv and verifying the files generated(answers-*.csv, landings-*.csv, questions-*.csv) contained the correct information.

$ tap-typeform --config config.json --properties catalog.json --state state.json | target-csv

Risks

Rollback steps

cmerrick commented 4 years ago

Hi @kingfink, thanks for your contribution!

In order for us to evaluate and accept your PR, we ask that you sign a contribution license agreement. It's all electronic and will take just minutes.

cmerrick commented 4 years ago

You did it @kingfink!

Thank you for signing the Singer Contribution License Agreement.