Well, it sucks but it's true. There's a bunch of noise on the Internet about how to do unique constraints in Google App Engine, but it seems like these are the only two safe ways. The thing to remember is, the only uniqueness that GAE will guarantee is on key names.
Approach #1: Make the unique field be the key name
As long as you promise to yourself that you'll never need to change the value, then you should make the unique field be the "key name" in the table. Then you can call db.Model.get_or_insert(key_name) to either retrieve an existing one or create a new one. Too bad in the real world, it's really hard to find something like this. Email addresses never change? Let me check my hotmail account. Social security numbers never change? Well, unless there was a typo. Every time I think I found a unique field that can never change, I'm proven wrong. So you'll never catch me doing this. But YMMV.
Approach #2: Create a separate table to track all used ids
This is pretty slick -- I found it in this article: Add a Unique Constraint to Google App Engine. The approach is to create a new table called Unique, and make the "key name" of each row in Unique be a combination of the name of the table and the unique field value. The downside is that you have extra storage overhead: a new table with the list of unique fields, plus the default indices that GAE makes for it. This is fairly analogous to declaring a unique index in SQL databases, since a unique SQL index is merely a persisted list of unique fields. There's just less overhead in a SQL database implementation because it's only one list, whereas in GAE this user-generated unique index is really one list (for the table) plus the default indices GAE makes for any entity.
I must say that Google is aware of this issue. It looks like they'd have to make some major architectural changes to implement this. My guess is if they ever fix this, they'll sneak in approach #2, above their BigTable support and below the API that us users use.
Excellent Blog every one can get lots of information for any topics from this blog nice work keep it up.
Posted by: Smartphone App Developer | 11/02/2012 at 03:23 AM
Maybe you can write next articles discussing this text.
Posted by: Nexik.Jogger.Pl | 03/02/2013 at 02:47 AM
It's nearly impossible to find well-informed people for this subject, but you seem like you know what you're talking about!
Thanks
Posted by: http://www.marblesthebrainstore.com/ | 03/12/2013 at 11:58 AM
Once I found this website I left on reddit to
share with you several of the love using their company.
Posted by: Maggie | 03/18/2013 at 12:34 AM
I wan’t going to comment as this posts a bit old
now, but just wanted to say thanks.
Posted by: Nextgenspeaksout.org | 03/24/2013 at 09:25 AM
Its like you read my mind! You seem to know so much about this, like you wrote the book in it or something.
I think that you could do with some pics to drive the message home a bit, but other than that, this is great blog.
A fantastic read. I'll definitely be back.
Posted by: cheap nike air max 90 | 03/29/2013 at 06:25 AM
Mobile application developers are competing in a relatively untapped market that requires individuality to gain boundless popularity. iPhones now hold the biggest share of the market of mobile phones although the market is becoming stiffer.
Posted by: android privacy app | 03/31/2013 at 06:02 AM
If you don't have a Mac you can purchase one since the iPhone development tools are only available for Mac users. You can purchase a Mac mini fairly cheap if you have a limited budget.
Posted by: essay help | 04/05/2013 at 11:33 AM
what did u say
Posted by: website | 04/06/2013 at 02:00 PM
While the reports were correct it took almost 4 years
before the application date. This is the most optimal time for conceiving and the surgery may also need to
undergo a bone marrow transplant. This remarkable drink has been documented
and practiced.Finally, if there are four areas to pass a written test,
after which you will have to undergo a bone marrow transplant.
In medical marketing firm with video production expertise can help treat back, buttocks, leg and foot problems, and
muscle, ligament and tendon-related medical conditions.
Posted by: roll On | 04/12/2013 at 03:16 AM
Hello, I enjoy reading all of your article.
I wanted to write a little comment to support you.
Posted by: ltd business | 04/14/2013 at 02:01 PM
Great To Read. Good Job, Keep Posting.
Posted by: raspberry ketone diet | 04/27/2013 at 01:53 AM
Google operates a strong developer's community for Android. The members of this community are by and large very friendly and cooperative. If you have any doubt regarding Android apps development, you can contact the community members for help.
Posted by: common application essay | 04/28/2013 at 06:06 AM
good post, i have been looking for it
Posted by: xcel energy | 04/30/2013 at 03:40 AM
Do you wish to begin getting paid real cash to spend time in Facebook, Twitter & Youtube?
Posted by: acne | 05/02/2013 at 05:43 AM
The article written very well, writing technique looked very skillful and has a good sense of humor, let a person think, and let people with a cheerful mood, the feeling is very good. I like the article, the heart be thank the authors of shares.
Posted by: latest resource | 05/09/2013 at 02:34 AM
Really it is nice post, The post is clearly highlighting the values of law. It is now being necessary for all of us to understand law and its values.
Posted by: resource | 05/09/2013 at 02:36 AM
This is a great post ! it was very informative. I look forward in reading more of your work. Also, I made sure to bookmark your website so I can come back later. I enjoyed every moment of reading it.
Posted by: visit site | 05/09/2013 at 02:36 AM
I’ve been writing essays for how many years and today I’m more on academic essay writing and I’m happy to be like my dad, a professional writer.
Posted by: Good resource for weight loss | 05/09/2013 at 02:37 AM
I really appreciate for your brilliant Efforts on spending time to post this information in a simple and systematic manner, so That visitors and readers can easily Understand the concept.I Efforts must appreciate you posting these on information.
Posted by: web site | 05/09/2013 at 02:38 AM
Very useful post and I think it is rather easy to see from the other comments as well that this post is well written and useful. I bookmarked this blog a while ago because of the useful content and I am never being disappointed. Keep up the good work.
Posted by: raspberry ketones | 05/09/2013 at 02:39 AM
Give the couple an order form and have them write down the numbers and sizes
that they are interested in for 5x7 and larger.
Research online and browse friend's wedding albums to get an idea of the type of poses and moments you want to commemorate. Some photographers are also including high resolution files in their packages.
Posted by: fotografia ślubna rzeszów | 05/15/2013 at 06:11 AM