Search code examples
google-app-enginegoogle-fusion-tablesgoogle-api-python-client

How to create a fusion table using the google-python-api


Using the API Client Library for Python what is the syntax for creating a new fusion table belonging to a Python AppEngine app's, service account?

Having created the service, I am not sure what interface methods it provides and can't find any documentation or examples other than ones that query existing tables, for example:

service.query().sql(sql=
"INSERT INTO %s (Temperature,Date) values(%s,'%s')" %
(tableid,value1,now)).execute()

There is an example for the REST API that I am trying to adapt.

fusion_columns = {
        "name": "Insects",
        "columns": [
            {
                "name": "Species",
                "type": "STRING"
            },
            {
                "name": "Elevation",
                "type": "NUMBER"
            },
            {
                "name": "Year",
                "type": "DATETIME"
            }
        ],
        "description": "Insect Tracking Information.",
        "isExportable": "true"
    }

    service = build('fusiontables', 'v2', credentials=credentials, )

    newtable = service.table().insert()
    newtable = service.table().insert(fusion_columns)

Neither of the last two lines are correct.

Would be better to switch to the REST-API and loose the Python API wrapper?


Solution

  • I found the reference here

    newtable = service.table().insert(body=*)