BigQuery doesn't seem to understand date-only timestamps when importing "JSON" using Python libraries. This manifests in the following entry in Google Cloud Function logs:
{
"textPayload": "Traceback (most recent call last):\n File \"/user_code/kcidb/db/__init__.py\", line 380, in load\n job.result()\n File \"/env/local/lib/python3.7/site-packages/google/cloud/bigquery/job.py\", line 812, in result\n return super(_AsyncJob, self).result(timeout=timeout)\n File \"/env/local/lib/python3.7/site-packages/google/api_core/future/polling.py\", line 130, in result\n raise self._exception\ngoogle.api_core.exceptions.BadRequest: 400 Error while reading data, error message: JSON table encountered too many errors, giving up. Rows: 1; errors: 1. Please look into the errors[] collection for more details.\n\nThe above exception was the direct cause of the following exception:\n\nTraceback (most recent call last):\n File \"/env/local/lib/python3.7/site-packages/google/cloud/functions/worker_v1.py\", line 402, in run_background_function\n _function_handler.invoke_user_function(event_object)\n File \"/env/local/lib/python3.7/site-packages/google/cloud/functions/worker_v1.py\", line 222, in invoke_user_function\n return call_user_function(request_or_event)\n File \"/env/local/lib/python3.7/site-packages/google/cloud/functions/worker_v1.py\", line 219, in call_user_function\n event_context.Context(**request_or_event.context))\n File \"/user_code/main.py\", line 172, in kcidb_load_queue\n DB_CLIENT.load(data)\n File \"/user_code/kcidb/db/__init__.py\", line 384, in load\n ])) from exc\nException: ERROR: Error while reading data, error message: JSON table encountered too many errors, giving up. Rows: 1; errors: 1. Please look into the errors[] collection for more details.\nERROR: Error while reading data, error message: JSON processing encountered too many errors, giving up. Rows: 1; errors: 1; max bad: 0; error percent: 0\nERROR: Error while reading data, error message: JSON parsing error in row starting at position 0: Couldn't convert value to timestamp: Could not parse '2020-09-13' as a timestamp. Required format is YYYY-MM-DD HH:MM[:SS[.SSSSSS]] or YYYY/MM/DD HH:MM[:SS[.SSSSSS]] Field: discovery_time; Value: 2020-09-13\n\n",
"insertId": "000000-34da1c79-def7-4674-a282-502b43a45b8f",
"resource": {
"type": "cloud_function",
"labels": {
"region": "us-central1",
"project_id": "kernelci-production",
"function_name": "playground_kcidb_load_queue"
}
},
"timestamp": "2020-09-18T15:21:01.906Z",
"severity": "ERROR",
"labels": {
"execution_id": "j41pbhj561th"
},
"logName": "projects/kernelci-production/logs/cloudfunctions.googleapis.com%2Fcloud-functions",
"trace": "projects/kernelci-production/traces/1374c54dd63048dfc81848d99ac79ed1",
"receiveTimestamp": "2020-09-18T15:21:02.260092087Z"
}
A possible fix might be either requiring a full timestamp or padding incomplete timestamps in KCIDB.