Huzaifa Patel
08/30/2024, 10:15 AMrequests.exceptions.JSONDecodeError: Extra data: line 1 column 11 (char 10)
The output of the API Request is in CSV format and I can see that this is a JSON error, so I was wondering if there is anything I need to change so the tap works for CSV outputs instead of JSON.Andy Carter
08/30/2024, 10:17 AMAndy Carter
08/30/2024, 10:18 AMHuzaifa Patel
08/30/2024, 10:24 AMHuzaifa Patel
08/30/2024, 10:26 AMdef parse_response(self, response: requests.Response) -> Iterable[dict]:
"""Parse the response and return an iterator of result records.
Args:
response: The HTTP ``requests.Response`` object.
Yields:
Each record from the source.
"""
response_content = response.content.decode('utf-8')
csv_file = io.StringIO(response_content)
reader = csv.DictReader(csv_file)
for row in reader:
yield row
Huzaifa Patel
08/30/2024, 10:49 AMAndy Carter
08/30/2024, 12:02 PMMissingKeyPropertiesError
Have you defined some custom streams? What key_properties do they have?Andy Carter
08/30/2024, 12:03 PM2024-08-30T10:11:20.288260Z [info ] raise MissingKeyPropertiesError( cmd_type=elb consumer=True job_name=test:tap-staffwise-to-target-csv name=target-csv producer=False run_id=a602a416-f781-407a-b357-53b5cc832a13 stdio=stderr string_id=target-csv
2024-08-30T10:11:20.288507Z [info ] singer_sdk.exceptions.MissingKeyPropertiesError: Record is missing one or more key_properties. cmd_type=elb consumer=True job_name=test:tap-staffwise-to-target-csv name=target-csv producer=False run_id=a602a416-f781-407a-b357-53b5cc832a13 stdio=stderr string_id=target-csv
2024-08-30T10:11:20.288972Z [info ] Key Properties: ['Shift ID'], Record Keys: ['Location', 'Location code', 'Salesforce ID', 'Type', 'Region', 'Date', 'Submission date', 'Staff', 'Parent Question', 'Question', 'Subject', 'Response'] cmd_type=elb consumer=True job_name=test:tap-staffwise-to-target-csv name=target-csv producer=False run_id=a602a416-f781-407a-b357-53b5cc832a13 stdio=stderr string_id=target-csv
Andy Carter
08/30/2024, 12:05 PMyield row
line and check to see the formation of the dict, and if it matches your schemaAndy Carter
08/30/2024, 12:06 PM2024-08-30T10:11:20.280025Z [info ] 2024-08-30 11:11:20,277 | WARNING | tap-staffwise.reporting | Properties ('\ufeff"Shift ID"',) were present in the 'reporting' stream but not found in catalog schema. Ignoring. cmd_type=elb consumer=False job_name=test:tap-staffwise-to-target-csv name=tap-staffwise producer=True run_id=a602a416-f781-407a-b357-53b5cc832a13 stdio=stderr string_id=tap-staffwise
Andy Carter
08/30/2024, 12:09 PMHuzaifa Patel
08/30/2024, 1:59 PM.decode(utf-8)
to .decode(utf-8-sig)
in the parse_response function. I have also resolved the MissingKeyPropertiesError.
I am still getting the error requests.exceptions.JSONDecodeError: Extra data: line 1 column 11 (char 10)
throughout my logs though. I've included the trace in a file with this message. Might also be some other errors in there too.Edgar Ramírez (Arch.dev)
08/30/2024, 2:40 PMEdgar Ramírez (Arch.dev)
08/30/2024, 2:44 PMnext_page_token_jsonpath
(and maybe records_jsonpath
for good measure)Edgar Ramírez (Arch.dev)
08/30/2024, 2:44 PMHuzaifa Patel
08/30/2024, 2:48 PM