使用python将geojson数据插入bigquery表

使用python将geojson数据插入bigquery表,python,google-bigquery,geojson,Python,Google Bigquery,Geojson,我对bigquery很陌生。 我尝试使用带有google cloud bigquery模块的python脚本在bigquery表中插入行 import bigquery client = bigquery.Client() # create table schema = [ bigquery.SchemaField("loc_id", "STRING", mode="REQUIRED"), bigquery.Sche

我对bigquery很陌生。 我尝试使用带有google cloud bigquery模块的python脚本在bigquery表中插入行

import bigquery

client = bigquery.Client()

# create table
schema = [
    bigquery.SchemaField("loc_id", "STRING", mode="REQUIRED"),
    bigquery.SchemaField("geo_shape", "GEOGRAPHY", mode="REQUIRED"),
]
table = bigquery.Table(table_full_name, schema=schema)
table = client.create_table(table)

# insert data
rows = get_rows()  # returns a list of tuples: [('id1', '{json1}'), ('id2', '{json2}'), ...}
print(rows[0])
# ('id1', {'coordinates': [[[1.7251409, 48.9844829], [...], [...], ...]], 'type': 'Polygon'})
result = client.insert_rows(table, rows)
print(result[0])
#  {'index': 0, 'errors': [{'reason': 'invalid', 'location': 'geo_shape', 'debugInfo': '', 'message': 'This field is not a record.'}]}
每行我都会得到“此字段不是记录”


我做错了什么?

Doh!别介意我。我刚刚发现我需要'json.dumps'mygeojson'dict'来让它工作。。。