python - Google App Engine Data Export to CSV TextProperty -


so have textproperty variable in google app engine (python). exporting data csv through remote api.

import csv class tower_of_london_history(db.model):     email = db.stringproperty(required=true)     start_datetime = db.datetimeproperty(required=true)     end_datetime = db.datetimeproperty(required=true)     duration_to_first_move = db.integerproperty(required=true)     completed = db.booleanproperty(required=true)     tower_type = db.stringproperty(required=true)     duration = db.integerproperty(required=true)     total_violations = db.integerproperty(required=true)     total_legal_moves = db.integerproperty(required=true)     time_type = db.stringproperty(required=true)     move_time_stamps = db.textproperty(required=true)     timezone = db.stringproperty(required=false)     utc_to_local_delta = db.integerproperty(required=false)  def exporttocsvtower_of_london_history(query, csvfilename, delimiter):     open(csvfilename, 'wb') csvfile:         csvwriter = csv.writer(csvfile, delimiter=delimiter, quotechar='|', quoting=csv.quote_minimal)         writeheadertower_of_london_history(csvwriter)          rowsperquery = 1000         totalrowssaved = 0         cursor = none         aremorerows = true          while aremorerows:             if cursor not none:                 query.with_cursor(cursor)             items = query.fetch(rowsperquery)             cursor = query.cursor()              currentrows =0             item in items:                 saveitemtower_of_london_history(csvwriter, item)                 currentrows += 1              totalrowssaved += currentrows             aremorerows = currentrows >= rowsperquery             print 'saved ' + str(totalrowssaved) + ' rows'          print 'finished saving rows.'  def writeheadertower_of_london_history(csvwriter):     csvwriter.writerow(['email', 'start_datetime', 'end_datetime', 'duration_to_first_move (seconds)', 'completed',                         'tower_type', 'duration (seconds)', 'total_violations', 'total_legal_moves', 'time_type',                         'move_time_stamps', 'timezone', 'utc_to_local_delta (mins)']) #output csv header  def saveitemtower_of_london_history(csvwriter, item):     csvwriter.writerow([item.email, item.start_datetime, item.end_datetime, item.duration_to_first_move,                          item.completed, item.tower_type, item.duration, item.total_violations, item.total_legal_moves,                         item.time_type, item.move_time_stamps, item.timezone, item.utc_to_local_delta]) # save items in preferred format  query = tower_of_london_history.gql("order email") exporttocsvtower_of_london_history(query, 'moment_exported_csv_files/tower_of_london_history.csv', ',') 

i following error

badvalueerror: property move_time_stamps 3085 bytes long; must 1500 or less. 

for information, use following run program : (on terminal) remote_api_shell.py -s app id import file_name

i wondering if there way textproperty bigger 1500 bytes can exported excel csv.

here's full trace

traceback (most recent call last):   file "<console>", line 1, in <module>   file "export_moment_data.py", line 568, in <module>     exporttocsvtower_of_london_history(query, 'moment_exported_csv_files/tower_of_london_history.csv', ',')   file "export_moment_data.py", line 387, in exporttocsvtower_of_london_history     items = query.fetch(rowsperquery)   file "/applications/googleappenginelauncher.app/contents/resources/googleappengine-default.bundle/contents/resources/google_appengine/google/appengine/ext/db/__init__.py", line 2161, in fetch     return list(self.run(limit=limit, offset=offset, **kwargs))   file "/applications/googleappenginelauncher.app/contents/resources/googleappengine-default.bundle/contents/resources/google_appengine/google/appengine/ext/db/__init__.py", line 2330, in next     return self.__model_class.from_entity(self.__iterator.next())   file "/applications/googleappenginelauncher.app/contents/resources/googleappengine-default.bundle/contents/resources/google_appengine/google/appengine/ext/db/__init__.py", line 1445, in from_entity     return cls(none, _from_entity=entity, **entity_values)   file "/applications/googleappenginelauncher.app/contents/resources/googleappengine-default.bundle/contents/resources/google_appengine/google/appengine/ext/db/__init__.py", line 973, in __init__     prop.__set__(self, value)   file "/applications/googleappenginelauncher.app/contents/resources/googleappengine-default.bundle/contents/resources/google_appengine/google/appengine/ext/db/__init__.py", line 617, in __set__     value = self.validate(value)   file "/applications/googleappenginelauncher.app/contents/resources/googleappengine-default.bundle/contents/resources/google_appengine/google/appengine/ext/db/__init__.py", line 2855, in validate     % (self.name, len(value), self.max_length)) badvalueerror: property move_time_stamps 3085 bytes long; must 1500 or less. 


Comments

Popular posts from this blog

javascript - Using jquery append to add option values into a select element not working -

Android soft keyboard reverts to default keyboard on orientation change -

Rendering JButton to get the JCheckBox behavior in a JTable by using images does not update my table -