I have got this example for inserting data into funsiontables...
The code basically creates a new table and store its id into a variable to support the insert, update or delete functions. The code is from 2010/2011 and I think google has change table_id format since then because I am getting the error below in the following line:
return 'INSERT INTO %d (%s) VALUES (%s)' % \
(int(table_id), ','.join(["'%s'" % col for col in cols]), stringValues)
Error:
(int(table_id), ','.join(["'%s'" % col for col in cols]), stringValues)
ValueError: invalid literal for int() with base 10: '1PHHo1h0tA0VxI09mAH0AH_IDNUpN5Hm-aTaAqO0'
I could simply change it to a simple SQL statement, but I am sure I will need to handle table_id or row_id in the next steps of the project. So, I would like to keep the way it has been done and if possible fix it. However, I could not understand the problem in the conversion to int over the table_id "1PHHo1h0tA0VxI09mAH0AH_IDNUpN5Hm-aTaAqO0"...
The function int() supports any integer or string...
Could anyone help me with that?
The table_id
does not appear to be a numeric integer.
You could try to modify the code as follows:
return 'INSERT INTO %s (%s) VALUES (%s)' % \
(table_id, ','.join(["'%s'" % col for col in cols]), stringValues)
In other words, using table_id
as a simple string.