Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to move all attributes in a datastore with value True to another datastore?
    primarykey
    data
    text
    <p>Is there a way of moving all attributes within a model with a value set to True to another model? I am writing in Python and have the following:</p> <pre><code> class crimechecker(webapp.RequestHandler): def get(self): #Checks for crime articles = Article.all().filter('crime = ', None) for article in articles: crime = False for word in triggers: body = article.body if body.find(word) != -1: crime = True article.crime = crime a = article.put() </code></pre> <p>Then a separate cron is run: and each crime story is added to Story with their location. But the stories are not appearing in the Story model?!</p> <pre><code>class place(webapp.RequestHandler): def post(self): # Check for any article which was classified as "TRUE" therefore it is a crime document crimes = Article.all().filter('crime = ', True) for crimestory in crimes: if Story.all().filter('title = ', crimestory.title).count() == 0: #Yahoo Placemaker key p = placemaker('HSnG9pPV34EUBcexz.tDYuSrZ8Hnp.LowswI7TxreF8sXrdpVyVIKB4uPGXBYOA9VjjF1Ca42ipd_KhdJsKYjI5cXRo0eJM-') #Encoding for symbols and euro signs etc. print p.find_places(crimestory.body.encode('utf-8')) for place in p.places: splitted = place.name.split() #Check for locations within Ireland (IE) if 'IE' in splitted: story = Story(long=place.centroid.longitude, lat=place.centroid.latitude, link=crimestory.link, loc_name=place.name, title=crimestory.title, date=crimestory.date).put() logging.info(story) </code></pre> <p>I have 2 models: an Article and Story. All articles are stored in the article model and any article with crime = True is set to be in the Story model. For some reason it is not moving the stories. The cron is running and not having any log errors. Can I do this task in my <strong>dashboard</strong>? I have queried both models :</p> <blockquote> <p>SELECT * FROM Article ORDER BY date DESC </p> </blockquote> <p>The Article model has stories from todays date (May 2nd)</p> <p>Story has articles from April 19th and no more since then. Can I query the models and say move all entities with crime set to true to the Story model?</p>
    singulars
    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.
 

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