3 ms·
You can compose queries like this: query = myModel.all().filter("property_1 =", value) query = query.filter("property_2 =", value) Here's a gotcha... be sure
by vosper 16y ago
You can compose queries like this:
query = myModel.all().filter("property_1 =", value)
query = query.filter("property_2 =", value)
Here's a gotcha... be sure to have a space between "property_1" and "=", "property_1=" won't work (but it won't raise an error either).
Be aware that the Datastore has very limited support for querying in general, and you will certainly not have anywhere near the kind of power you are used to when composing queries in .Net with something like LINQ.
GAE is a good start if you want to learn Python, but it is a terrible platform for web development. You will find yourself stymied and frustrated by its inflexibility, the need to give up your normalized data model from Day 1, lack of referential integrity, and the awful performance compared to a real SQL database.
Oh, and the constant outages, the scheduled maintenance that borks the whole system for a week, the backup tool that takes 4 hours to run and then crashes trying to restore the backups... I have a long list :)
- Tycho 16y agoThanks for the advice. My program wont be doing any heavy lifting, it's just a simple tool to guide the SQL-writing process and save the user typing everything out down to the last semi-colon; a visual aid really. All I need is a tiny bit of graphical whizzbang, so it's not a totally static form - the labels/menus change somewhat, more fields/labels are added, according to the user input.
- vosper 16y agotry to stop thinking in terms of SQL, if you can - although they call it GQL it's only superficially similar. One particularly big gotcha is that you can only return keys or whole objects in your queries, and if you return an object it has to deserialize all the data associated with that object, so think twice before storing binary data against a frequently queried object - look to the BlobStore (this is NOT the same as a BlobProperty) or a separate object to hold larger chunks of data. This is something to consider at the get go, you'd be surprised how quickly performance degrades (ie a hundred or more items, not thousands)