title: error on inserting timestamp value in bigquery from python3.7
body: <p>i am calling a rest api from python3.7 and I am getting api response in json format. One of the fields is a timestamp string, but in the json response i am getting that in this format.</p>
  <pre><code>create_time {
    seconds: 1604562539
    nanos: 418758000
  }
  </code></pre>
  <p><strong><strong>I need to insert this into a bigquery table in UTC format</strong> which is a timestamp field</strong></p>
  <p>so I convert this to Json string like this</p>
  <p>createdtime=json.dumps(create_time, default=datetime_handler)</p>
  <pre><code>def datetime_handler(dt):
      if isinstance(dt, datetime):
          return dt.isoformat()
      raise TypeError(&quot;Unknown type&quot;)
  </code></pre>
  <p>this gives me a json string in this format <strong>2020-11-05T07:48:59.418758+00:00</strong></p>
  <p>next I need to try to insert this create_time into big-query table in a timestamp field by passing this value to the bigquery request and i get the insert error</p>
  <pre><code> 'bigquery#tableDataInsertAllResponse', 'insertErrors': [{'index': 0, 'errors': [{'reason': 'invalid', 'location': 'createdtime', 'debugInfo': '', 'message': 'Could not parse \'&quot;2020-11-05T07:48:59.418758+00:00&quot;\' as a timestamp. Required format is YYYY-MM-DD HH:MM[:SS[.SSSSSS]]'}]}
  </code></pre>
  <p>so I remove the offset(00:00) and now the date becomes <strong>2020-11-05T07:48:59.418758</strong> and i pass this to bigquery again i get the same error.</p>
  <pre><code>'bigquery#tableDataInsertAllResponse', 'insertErrors': [{'index': 0, 'errors': [{'reason': 'invalid', 'location': 'createdtime', 'debugInfo': '', 'message': 'Could not parse \'&quot;2020-11-05T07:48:59.418758&quot;\' as a timestamp. Required format is YYYY-MM-DD HH:MM[:SS[.SSSSSS]]'}]},
  </code></pre>
  <p>so finally i replace the offset with Z and the createdtime becomes <strong>2020-11-05T07:48:59.418758Z</strong> and i pass it to bigquery and get the same result</p>
  <pre><code>**Error: {'kind': 'bigquery#tableDataInsertAllResponse', 'insertErrors': [{'index': 0, 'errors': [{'reason': 'invalid', 'location': 'createdtime', 'debugInfo': '', 'message': 'Could not parse \'&quot;2020-11-05T07:48:59.418758Z&quot;\' as a timestamp. Required format is YYYY-MM-DD HH:MM[:SS[.SSSSSS]]'}]}**
  </code></pre>
  <p>And finally based on one of the suggestions i received below i have replaced <strong>T</strong> also so now the date becomes <strong>2020-11-05 07:48:59.418758</strong>
  and I still get the same error:</p>
  <pre><code>Error: {'kind': 'bigquery#tableDataInsertAllResponse', 'insertErrors': [{'index': 0, 'errors': [{'reason': 'invalid', 'location': 'createdtime', 'debugInfo': '', 'message': 'Could not parse \'&quot;2020-11-05 07:48:59.418758&quot;\' as a timestamp. Required format is YYYY-MM-DD HH:MM[:SS[.SSSSSS]]'}]},
  </code></pre>
  <p>I am very new to python3.7 and also not much familiar with timestamp values in python and bigquery, Can anyone please suggest a solution? Thanks</p>
  <p>This is the code I have put all the irrelevant parts also for understanding:</p>
  <pre><code>    row={}
  rows=[]
       def datetime_handler(dt):
              if isinstance(dt, datetime):
                  return dt.isoformat()
              raise TypeError(&quot;Unknown type&quot;)
       createdtime=json.dumps(snapshotresponse.create_time,default=datetime_hander)
      createdtime=createdtime.replace(&quot;+00:00&quot;, &quot;&quot;).replace('T',&quot; &quot;)
      row[&quot;createdTime&quot;]= createdtime
      json_msg = {
                             &quot;json&quot;: row
                          }
      rows.append(json_msg)
      body = {
              &quot;kind&quot;: &quot;bigquery#tableDataInsertAllRequest&quot;,
              &quot;skipInvalidRows&quot;: &quot;false&quot;,
              &quot;rows&quot;: rows
                  }
   
  </code></pre>