如何在融合表中动态更新日期列

时间:2014-04-15 22:11:55

标签: python-2.7 google-fusion-tables

for value in f:
  value = value.replace("\n", "")
  print value
  now = datetime.datetime.now()
  k = now.strftime("%Y-%m-%d %H:%M:%S")
  print k
  # Get rows of a tables
  request = urllib2.Request(u'https://www.googleapis.com/fusiontables/v1/query?%s'\
                        %(urllib.urlencode({'access_token': access_token, 'sql': "SELECT FREQUENCY, ROWID,date FROM %s WHERE ACTIVITY LIKE '%s'" % (table_id, value)})))
  url = u'https://www.googleapis.com/fusiontables/v1/query'
  headers =  {u'Authorization': 'Bearer %s' %access_token,
              u'Content-Type': u'application/x-www-form-urlencoded'} #application/json  
  if modval == 0: 
    data = {u'sql' : u"INSERT INTO %s(ACTIVITY,FREQUENCY,date) VALUES ('%s',1,%s);" % (table_id, value,k)}
  else:
    print "Incrementing to %d" % modval
    print " date modified to %s" %k
    data = {u'sql' : u"UPDATE %s SET FREQUENCY = %d,date=%s WHERE ROWID = '%s'and date='%s';" % (table_id,modval, rowid,k)} 

我能够在我的python输出中看到更新的时间戳,但在融合表中没有可以帮助我

0 个答案:

没有答案