Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Diagnosing Google Fusion Table update using API to upload CSV issue

I'm trying to diagnose issues updating Google Fusion Tables using CSV data via the API. Everything seems to work correctly code side of things with no errors reported but the data does not reflect the changes. Any ideas how I can diagnose what is going wrong?

I've been using the Google.Apis.Fusiontables.v2 C# libraries (v1.27.1.833 is latest I've tried) to update a fusion table daily. The process was working seamlessly for quite a while, but now no longer seems to work. I suspect the process has been broken for a month or more now.

Everything seems to work from the code side of things, no errors reported. I've also been debugging the process from within Visual Studio with no problems indicated - it just seems to work from the client side.

In case it's useful the C# method I'm using is:

fusiontablesService.Table.ReplaceRows(tableId, stream, "application/octet-stream").Upload();

The table I am attempting to update is - https://fusiontables.google.com/DataSource?docid=1ndrFm1g0iZpz5gszjz5Ij9r_KiQbNYRXVM2JNfv3

The UpdatedUtc column indicates that a few updated rows are getting through, but not all of them.

If I export my CSV stream to a physical file and created a new Fusion Table manually via the web UI this works perfectly and shows all the missing data I expect to be there.

Here's the zipped CSV file in case it's useful - http://www.paydirt.co.nz/stackoverflow/GoldPermits.zip

This is the test Fusion Table I imported the CSV file manually into - https://www.google.com/fusiontables/DataSource?docid=1Udnre88O8e1zokvnhrkmqdY7BbYD2OQtELdyz3uG

Example of missing data in the live table updates: enter image description here

Compared to the test table created from the same data: enter image description here

The PERMIT_NUMBER's for the 2 missing rows in the example are 60304 and 60247.

Any ideas how I can investigate further what might be going wrong? Maybe there's some logs or logging options available somewhere I'm unaware of?

Any help / ideas to explore is greatly appreciated.

like image 444
Gavin Avatar asked Nov 08 '22 05:11

Gavin


1 Answers

Upload from fusiontablesService.Table.ReplaceRows(...).Upload() returns a Google.Apis.Upload.ResumableUpload.ResumableUploadProgress object which has both aStatus and Exception property that can be checked.

In my case I was getting the following progress result:

{Google.Apis.Upload.ResumableUpload.ResumableUploadProgress}
    BytesSent: 10485760
    Exception: {"Google.Apis.Requests.RequestError\r\nContent has a different number of columns than the table (line 1). [400]\r\nErrors [\r\n\tMessage[Content has a different number of columns than the table (line 1).] Location[ - ] Reason[badImportNumColumnsMismatch] Domain[fusiontables]\r\n]\r\n"}
    Status: Failed
like image 187
Gavin Avatar answered Nov 14 '22 23:11

Gavin