Andy Carter
04/19/2023, 12:46 PM"timestamp_signup": {
"type": [
"null",
"string"
],
"format": "date-time"
},
But the API returns empty string for this field when null
"timestamp_signup": "",
Which results in:
ValueError: Could not parse value '' for field 'timestamp_signup'
2023-04-19T12:13:36.921311Z [info ] raise ParserError("String does not contain a date: %s", timestr) cmd_type=elb consumer=True name=target-mssql producer=False stdio=stderr string_id=target-mssql
2023-04-19T12:13:36.922028Z [info ] dateutil.parser._parser.ParserError: String does not contain a date: cmd_type=elb consumer=True name=target-mssql producer=False stdio=stderr string_id=target-mssql
This is only an issue when the object has the format=date-time
designation.
Do I have to special-case this myself? Implement post_process()
and then coerce empty string to a proper python None
? Or can meltano handle 'false-y' values like this, and I'm just missing the magic command?Matt Menzenski
04/19/2023, 1:21 PMAndy Carter
04/19/2023, 1:30 PMnull
pat_nadolny
04/19/2023, 1:46 PMAndy Carter
04/19/2023, 1:55 PMtap-mailchimp
version using the sdk, I will check the hub variant to see how these fields are handled as I don't recall getting many issues with the hub variant, maybe there was some internal conversion going on.
I used the schema.json files from there as a starting point.pat_nadolny
04/19/2023, 2:17 PMAndy Carter
04/19/2023, 2:45 PMdef post_process(self, row: dict, context: dict | None = None) -> dict | None:
"""
This API returns empty strings in place of nulls
Need to convert these to true nulls to get correct datetime handling,
otherwise errors from trying to generate datetime from "".
"""
row = {
k: None if v == "" else v
for k,v
in row.items()
}
return row
but wasn't sure at what point the object gets validated against the schema, if I just invoke the tap will it get validated? Or only as I'm writing to target? I THINK I didn't get the issue using target-jsonl
from hub, only with target-mssql
pat_nadolny
04/19/2023, 3:02 PM