-
Notifications
You must be signed in to change notification settings - Fork 31
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
Formatting of datetime #49
Comments
I think you are correct, we need to bump this target's dependency on singer-python based on the code here - https://github.com/singer-io/target-stitch/blob/master/target_stitch/__init__.py#L266-L267 But its attempting to parse a string of |
After some more research it could also be this code: https://github.com/singer-io/singer-python/blob/master/singer/messages.py#L61-L63 |
Hi @KAllan357, I've checked the output of the tap (dumped to a file) and checked the output of target-csv and all were fine. In the custom tap I'm loggin as such: def format_timestamp(data, typ, schema):
result = data
if typ == 'string' and schema.get('format') == 'date-time':
rfc3339_ts = rfc3339_to_timestamp(data)
utc_dt = datetime.datetime.utcfromtimestamp(rfc3339_ts).replace(tzinfo=pytz.UTC)
result = utils.strftime(utc_dt)
return result
def sync(resource):
rows = http.request(
resource, "GET", RESOURCES[resource]["url"]
)
with Transformer(pre_hook=format_timestamp) as transformer:
for row in rows:
transformed_row = transformer.transform(row, RESOURCES[resource]["schema"])
singer.write_record(resource, transformed_row, time_extracted=utils.now()) |
@ChrisCalculus I've worked up a few PRs for cases in singer-python and target-stitch that should address the possible formatting issues in them. I won't be able to do a release until later tonight at the earliest, but in the meantime, you can check these out to see if they fix your issue! |
Hi @dmosorast thanks for your response. I just pulled the new versions (stitch-target=1.7.2), but was only able to get things working when correcting Thanks again! |
Thanks for the testing and feedback! @ChrisCalculus It didn't seem like it at first, but I suppose the target code is implictly calling |
I think this target is bothered by a similar issue as reported here for which a PR was written in singer-python.
My case:
"singer-python==5.0.0",
I've upgrade to"singer-python>=5.0.14",
to prevent this issue.However during the execution:
Note: Target CSV works without issues since the PR was merged.
The text was updated successfully, but these errors were encountered: