<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
		>
<channel>
	<title>Comments on: Add a Unique Constraint to Google App Engine</title>
	<atom:link href="http://squeeville.com/2009/01/30/add-a-unique-constraint-to-google-app-engine/feed/" rel="self" type="application/rss+xml" />
	<link>http://squeeville.com/2009/01/30/add-a-unique-constraint-to-google-app-engine/</link>
	<description>Jason Collins. No redaction.</description>
	<lastBuildDate>Tue, 29 Mar 2011 10:02:27 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
	<item>
		<title>By: Jason Collins</title>
		<link>http://squeeville.com/2009/01/30/add-a-unique-constraint-to-google-app-engine/#comment-189</link>
		<dc:creator><![CDATA[Jason Collins]]></dc:creator>
		<pubDate>Thu, 16 Sep 2010 16:14:59 +0000</pubDate>
		<guid isPermaLink="false">http://squeeville.com/?p=65#comment-189</guid>
		<description><![CDATA[I agree Nick and Tonny, it&#039;s always best to work the unique, immutable key into the key of the entity.

However, I think this is a good, and common, example as people&#039;s email address changes over time, and that doesn&#039;t mean the Account should have to change. A similar example is how you can adjust your Twitter screen_name (which is your login/username), but the rest of the Account is unchanged.

Something that isn&#039;t mentioned in this post is that if you do allow someone to change this value (e.g., change their email on the Account), you have to explicitly remove the old email from Unique - that is, if you want it to be able to to be used again in the future.]]></description>
		<content:encoded><![CDATA[<p>I agree Nick and Tonny, it&#8217;s always best to work the unique, immutable key into the key of the entity.</p>
<p>However, I think this is a good, and common, example as people&#8217;s email address changes over time, and that doesn&#8217;t mean the Account should have to change. A similar example is how you can adjust your Twitter screen_name (which is your login/username), but the rest of the Account is unchanged.</p>
<p>Something that isn&#8217;t mentioned in this post is that if you do allow someone to change this value (e.g., change their email on the Account), you have to explicitly remove the old email from Unique &#8211; that is, if you want it to be able to to be used again in the future.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Nick Johnson</title>
		<link>http://squeeville.com/2009/01/30/add-a-unique-constraint-to-google-app-engine/#comment-188</link>
		<dc:creator><![CDATA[Nick Johnson]]></dc:creator>
		<pubDate>Wed, 15 Sep 2010 10:14:03 +0000</pubDate>
		<guid isPermaLink="false">http://squeeville.com/?p=65#comment-188</guid>
		<description><![CDATA[While occasionally it&#039;s useful to have a unique value that isn&#039;t also the primary key, in most cases, including this one, it would make more sense to just make the unique value the key name for the model. Then, you&#039;d ensure uniqueness with no extra overhead, and you could look up an entity by its key with a single get, instead of a query.]]></description>
		<content:encoded><![CDATA[<p>While occasionally it&#8217;s useful to have a unique value that isn&#8217;t also the primary key, in most cases, including this one, it would make more sense to just make the unique value the key name for the model. Then, you&#8217;d ensure uniqueness with no extra overhead, and you could look up an entity by its key with a single get, instead of a query.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Tonny Staunsbrink</title>
		<link>http://squeeville.com/2009/01/30/add-a-unique-constraint-to-google-app-engine/#comment-187</link>
		<dc:creator><![CDATA[Tonny Staunsbrink]]></dc:creator>
		<pubDate>Wed, 15 Sep 2010 08:01:59 +0000</pubDate>
		<guid isPermaLink="false">http://squeeville.com/?p=65#comment-187</guid>
		<description><![CDATA[Interrestring solution. But wouldn&#039;t you usually incorporate the uniqueness in the key of the primary entity.

I think I would use this solution for mutable data, which is not part of the primary (since primary keys should not be mutable anyhow).]]></description>
		<content:encoded><![CDATA[<p>Interrestring solution. But wouldn&#8217;t you usually incorporate the uniqueness in the key of the primary entity.</p>
<p>I think I would use this solution for mutable data, which is not part of the primary (since primary keys should not be mutable anyhow).</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jason Collins</title>
		<link>http://squeeville.com/2009/01/30/add-a-unique-constraint-to-google-app-engine/#comment-178</link>
		<dc:creator><![CDATA[Jason Collins]]></dc:creator>
		<pubDate>Wed, 05 May 2010 03:27:14 +0000</pubDate>
		<guid isPermaLink="false">http://squeeville.com/?p=65#comment-178</guid>
		<description><![CDATA[The call to Unique.check() &quot;reserves&quot; (and stores) the unique value in the Unique model, so if it succeeds the value is all yours. If another process attempts to do a Unique.check() immediately after, it will fail.

A caveat of this is that if your a.put() fails, you&#039;ve lost your unique value unless you take some other compensating action (e.g., removing the unique value from the Unique model).]]></description>
		<content:encoded><![CDATA[<p>The call to Unique.check() &#8220;reserves&#8221; (and stores) the unique value in the Unique model, so if it succeeds the value is all yours. If another process attempts to do a Unique.check() immediately after, it will fail.</p>
<p>A caveat of this is that if your a.put() fails, you&#8217;ve lost your unique value unless you take some other compensating action (e.g., removing the unique value from the Unique model).</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jeff McNeil</title>
		<link>http://squeeville.com/2009/01/30/add-a-unique-constraint-to-google-app-engine/#comment-177</link>
		<dc:creator><![CDATA[Jeff McNeil]]></dc:creator>
		<pubDate>Thu, 22 Apr 2010 17:35:30 +0000</pubDate>
		<guid isPermaLink="false">http://squeeville.com/?p=65#comment-177</guid>
		<description><![CDATA[Isn&#039;t there still a race condition between Unique.check and a.put()? The code formatting is a bit off for me so I might have missed it?]]></description>
		<content:encoded><![CDATA[<p>Isn&#8217;t there still a race condition between Unique.check and a.put()? The code formatting is a bit off for me so I might have missed it?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: JJC1138</title>
		<link>http://squeeville.com/2009/01/30/add-a-unique-constraint-to-google-app-engine/#comment-104</link>
		<dc:creator><![CDATA[JJC1138]]></dc:creator>
		<pubDate>Tue, 12 May 2009 15:51:00 +0000</pubDate>
		<guid isPermaLink="false">http://squeeville.com/?p=65#comment-104</guid>
		<description><![CDATA[Thank you!]]></description>
		<content:encoded><![CDATA[<p>Thank you!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jason Collins</title>
		<link>http://squeeville.com/2009/01/30/add-a-unique-constraint-to-google-app-engine/#comment-103</link>
		<dc:creator><![CDATA[Jason Collins]]></dc:creator>
		<pubDate>Tue, 12 May 2009 15:27:27 +0000</pubDate>
		<guid isPermaLink="false">http://squeeville.com/?p=65#comment-103</guid>
		<description><![CDATA[Sure - have fun!]]></description>
		<content:encoded><![CDATA[<p>Sure &#8211; have fun!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: JJC1138</title>
		<link>http://squeeville.com/2009/01/30/add-a-unique-constraint-to-google-app-engine/#comment-102</link>
		<dc:creator><![CDATA[JJC1138]]></dc:creator>
		<pubDate>Tue, 12 May 2009 00:27:01 +0000</pubDate>
		<guid isPermaLink="false">http://squeeville.com/?p=65#comment-102</guid>
		<description><![CDATA[This looks very useful. Is the code public domain? Thank you.]]></description>
		<content:encoded><![CDATA[<p>This looks very useful. Is the code public domain? Thank you.</p>
]]></content:encoded>
	</item>
</channel>
</rss>

