Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Here is one quick thought, assuming it is crapping out fetching from the datastore. You could use <a href="http://code.google.com/appengine/docs/python/taskqueue/overview.html" rel="nofollow">tasks</a> and <a href="http://code.google.com/appengine/docs/python/datastore/queryclass.html#Query_cursor" rel="nofollow">cursors</a> to fetch the data in smaller chunks, then do the generation at the end.</p> <p>Start a task which does the initial query and fetches 300 (arbitrary number) records, then enqueues a named(!important) task that you pass the cursor to. That one in turn queries <em>[your arbitrary number]</em> records, and then passes the cursor to a new named task as well. Continue that until you have enough records.</p> <p>Within each task process the entities, then store the serialized result in a text or blob property on a 'processing' model. I would make the model's key_name the same as the task that created it. Keep in mind the serialized data will need to be under the API call size limit.</p> <p>To serialize your table pretty fast you could use:</p> <pre><code>serialized_data = "\x1e".join("\x1f".join(voter) for voter in data) </code></pre> <p>Have the last task (when you get enough records) kick of the PDf or CSV generation. If you use key_names for you models you, should be able to grab all of the entities with encoded data by key. Fetches by key are pretty fast, you'll know the model's keys since you know the last task name. Again, you'll want to be mindful size of your fetches from the datastore!</p> <p>To deserialize:</p> <pre><code>list(voter.split('\x1f') for voter in serialized_data.split('\x1e')) </code></pre> <p>Now run your PDF / CSV generation on the data. If splitting up the datastore fetches alone does not help you'll have to look into doing more of the processing in each task.</p> <p>Don't forget in the 'build' task you'll want to raise an exception if any of the interim models are not yet present. Your final task will automatically retry.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload