python - How to get the distinct value of one of my models in Google App Engine -


I have a model, below, and I would like to get all the specific field values ​​< / Code>

  class tutorial SQL equals  select from different areas tutorial (db.Model): path = db.StringProperty () area = db.StringProperty () sub_area = db .StringProperty () title = db.StringProperty () content = db.BlobProperty () Rating = db.RatingProperty () publishedDate = db.DateTimeProperty () published = db.BooleanProperty ()  

I know that I can do Python

  a = ['google.com', 'la Vjornl dot com ',' Laivjornl dot com ',' google.com ',' Stakvovrflo. Com '] B = set (A) B & gt; & Gt; & Gt; Set (['livejournal.com', 'google.com', 'stackoverflow.com'])  

But I need to take the objects in the field out of query to another list And it is going against the list (it seems very inefficient) and if I have a separate item which is in the 1001 position in the datasheet, then I will not see it due to the fetch limit of 1000.

I will find all the different values ​​in the area in my datasheet to dump on the screen in the form of links.

Datastore can not do it in the same query to one of your datastore request always results from an index Gives a consistent block of, and an index always consists of all types of institutions, which are ordered according to the order specified. There is no way to leave items due to duplicate values ​​in a field.

An alternative introduced a new entity type that represents a "region for example to restructure your data" to add a tutorial to make related "zone" if it does not already exist , and if the "tutorial" there is still no tutorial with "area", so Tutorl delete each field that removing the "field" number of tutorials that area Micro stores, so it is pretty much can not be serious (though relevant factors with transactions etc. feel really good). I hope the key area of ​​the unit can be based on the string, which means that you can always look for the regional institutions rather than the main lookup instead of the query.

Another option is to use a queued work or a cron job to periodically create a list of all areas, if it is needed, on many requests, deposits, and the results are either datasheet or Put in the memkesh. This would mean that the list of areas can temporarily be out of time (or if there are continuous changes, it can never be fully), which can not be acceptable for you or not .

Finally, if there are a lot of areas in comparison to the tutorials, then you can fly by requesting tutorial (sorted by area) first, then the first tutorial is requested whose area is the area of ​​the first area More than, and so on. But this requires a request for each specific area, so there is no possibility of it being fast.


Comments

Popular posts from this blog

c# - ListView onScroll event -

PHP - get image from byte array -

Linux Terminal Problem with Non-Canonical Terminal I/O app -