I had a similar issue. My code may be able to help someone facing this issue using Java.
I needed to update information in rows of a fusion table in many different ways that were unsupported by fusion tables implementation of SQL. I wrote a java program to help me do my updates. (I'm trying to clean up my data in my fusion table.) I also needed to find a nearby large city / state and update fields in rows with this information. Anyway, you can see the entire program on github.
The entire project directory is found on github here: https://github.com/gjkendall/FusionTableModifyJava
The code of interest is in FusionTableSample.java based on Google/Christian Junks example program of how to create, access and modify fusion tables in java. I'm new a java so it might not be the best code.
You will see a lot of commented code where I did different SQL searches for different things I needed to modify. These are there so I can reference them for future searches.
The program first does a SQL search for the rows I want to modify and puts those rows into an array(mylist). The project goes through the array mylist one row at a time, makes it's modifications (currently I needed to access geonames to get city and state info based on locations in my table) and then updates the row with a fusion table SQL call.
The routine that does the updates row by row is "updateRows" shown here:
private static void updateRows(String tableId) throws IOException {
// IOException needed ParseException
count = 1;
mylist.forEach((myRow) -> {
try {
// modify fields in table...
//newAreaName = kt.firstpart(myRow.get(NOTES).toString()); //get Notes first sentence
//newAreaName = newAreaName.replace("'", "''");
//newAreaName += " X01";
//String state = getStateFrmLoc(myRow.get(LOCATION).toString());
//String state = "MX-BCS";
float km;
if ( "AK,MT,NV".contains(myRow.get(STATE).toString()) ) {
km = 180f; // 111.85 miles
} else {
km = 80.5f; // 50 miles
}
BigCity big = new BigCity(myRow.get(LOCATION).toString(), km);
String cityState = big.cityName +", "+big.state;
if (big.population < 10000f) {
System.out.println("Skip for low population :"+myRow.get(NUMBER));
} else {
sqlupdate = "UPDATE " + tableId + " " +
"SET 'City (nearest)' = '" + cityState + "' " +
",'Codes' = '" + myRow.get(CODES).toString() + ",#U1' " +
"WHERE ROWID = " + myRow.get(ROW_ID);
System.out.println("[" + count + "]" + myRow.get(NUMBER) + ": " + sqlupdate);
// do the update...
if (!mtest) { // if testing then don't update
sql_doupdate(sqlupdate);
}
count++;
if ((count % 30) == 0) {
System.out.println("waiting 60 seconds");
TimeUnit.SECONDS.sleep(60); //Fusion Tables allows 30 updates then must wait 1 minute.
}
}
} catch(Exception e){
System.out.println(e.getMessage());
}
});
}