singer-io / tap-adwords

GNU Affero General Public License v3.0
29 stars 37 forks source link

Datetime format error on bookmark creation #50

Open zenkay opened 5 years ago

zenkay commented 5 years ago

We are experiencing an issue when we try to export any report. The library tries to get a start date for stream and fail because of the date format.

Here is the traceback:

CRITICAL ('Unknown string format:', '4Y-06-02T00:00:00.000000Z')
Traceback (most recent call last):
  File "/Users/guest/anaconda3/envs/singer_adwords/bin/tap-adwords", line 10, in <module>
    sys.exit(main())
  File "/Users/guest/anaconda3/envs/singer_adwords/lib/python3.7/site-packages/tap_adwords/__init__.py", line 1061, in main
    raise exc
  File "/Users/guest/anaconda3/envs/singer_adwords/lib/python3.7/site-packages/tap_adwords/__init__.py", line 1058, in main
    main_impl()
  File "/Users/guest/anaconda3/envs/singer_adwords/lib/python3.7/site-packages/tap_adwords/__init__.py", line 1051, in main_impl
    do_sync_all_customers(customer_ids, args.properties)
  File "/Users/guest/anaconda3/envs/singer_adwords/lib/python3.7/site-packages/tap_adwords/__init__.py", line 1037, in do_sync_all_customers
    do_sync(properties, sdk_client)
  File "/Users/guest/anaconda3/envs/singer_adwords/lib/python3.7/site-packages/tap_adwords/__init__.py", line 860, in do_sync
    sync_stream(stream_name, stream_metadata, sdk_client)
  File "/Users/guest/anaconda3/envs/singer_adwords/lib/python3.7/site-packages/tap_adwords/__init__.py", line 851, in sync_stream
    sync_report(stream_name, stream_metadata, sdk_client)
  File "/Users/guest/anaconda3/envs/singer_adwords/lib/python3.7/site-packages/tap_adwords/__init__.py", line 230, in sync_report
    sync_report_for_day(stream_name, stream_schema, sdk_client, start_date, field_list)
  File "/Users/guest/anaconda3/envs/singer_adwords/lib/python3.7/site-packages/tap_adwords/__init__.py", line 362, in sync_report_for_day
    if start > get_start_for_stream(sdk_client.client_customer_id, stream_name):
  File "/Users/guest/anaconda3/envs/singer_adwords/lib/python3.7/site-packages/tap_adwords/__init__.py", line 149, in get_start_for_stream
    bk_start_date = utils.strptime_with_tz(bk_value or CONFIG['start_date'])
  File "/Users/guest/anaconda3/envs/singer_adwords/lib/python3.7/site-packages/singer/utils.py", line 21, in strptime_with_tz
    d_object = dateutil.parser.parse(dtime)
  File "/Users/guest/anaconda3/envs/singer_adwords/lib/python3.7/site-packages/dateutil/parser/_parser.py", line 1358, in parse
    return DEFAULTPARSER.parse(timestr, **kwargs)
  File "/Users/guest/anaconda3/envs/singer_adwords/lib/python3.7/site-packages/dateutil/parser/_parser.py", line 649, in parse
    raise ValueError("Unknown string format:", timestr)
ValueError: ('Unknown string format:', '4Y-06-02T00:00:00.000000Z')

The date displayed in the STATE row has the same problem:

{"type": "STATE", "value": {"bookmarks": {"CAMPAIGN_PERFORMANCE_REPORT_XXXXXXXXXX": {"last_attribution_window_date": "4Y-06-02T00:00:00.000000Z", "date": "4Y-06-02T00:00:00.000000Z"}}}}
victortranell commented 5 years ago

Came across the same issue and ended up with the same solution. When can this be merged?