<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	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:slash="http://purl.org/rss/1.0/modules/slash/"
	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>Clueless !!! &#187; Uncategorized</title>
	<atom:link href="http://vidyanand.wordpress.com/category/uncategorized/feed/" rel="self" type="application/rss+xml" />
	<link>http://vidyanand.wordpress.com</link>
	<description>A journal to keep track of my experimentation with different technologies</description>
	<lastBuildDate>Mon, 16 Jun 2008 19:43:08 +0000</lastBuildDate>
	<generator>http://wordpress.com/</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<cloud domain='vidyanand.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://www.gravatar.com/blavatar/7823f7de0becd7a56c77fa5a3568d0d9?s=96&#038;d=http://s.wordpress.com/i/buttonw-com.png</url>
		<title>Clueless !!! &#187; Uncategorized</title>
		<link>http://vidyanand.wordpress.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://vidyanand.wordpress.com/osd.xml" title="Clueless !!!" />
		<item>
		<title>Is it a MySQL or Django fault ?</title>
		<link>http://vidyanand.wordpress.com/2008/06/16/is-it-a-mysql-or-django-fault/</link>
		<comments>http://vidyanand.wordpress.com/2008/06/16/is-it-a-mysql-or-django-fault/#comments</comments>
		<pubDate>Mon, 16 Jun 2008 19:43:08 +0000</pubDate>
		<dc:creator>vidyanand</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://vidyanand.wordpress.com/?p=10</guid>
		<description><![CDATA[Well I am not really sure whom to fault on that. But I am only super glad that I did double check the database constraints.
Django has this super cool feature which lets you create the tables in the database &#8212; &#8220;syncdb&#8221;. When you are using a MySQL database this is a part of what you [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=vidyanand.wordpress.com&blog=37367&post=10&subd=vidyanand&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>Well I am not really sure whom to fault on that. But I am only super glad that I did double check the database constraints.</p>
<p>Django has this super cool feature which lets you create the tables in the database &#8212; &#8220;syncdb&#8221;. When you are using a MySQL database this is a part of what you will end up getting:</p>
<p style="padding-left:30px;"><em>CREATE TABLE `auth_user_groups` (<br />
`id` integer AUTO_INCREMENT NOT NULL PRIMARY KEY,<br />
<strong> `user_id` integer NOT NULL REFERENCES `auth_user` (`id`),<br />
`group_id` integer NOT NULL REFERENCES `auth_group` (`id</strong>`),<br />
UNIQUE (`user_id`, `group_id`)<br />
);</em></p>
<p>That sounds like a perfectly valid SQL statement and tables get created perfectly fine. The lines in bold indicate that there is a foreign key to another table&#8217;s column from the current table. But when I run syncdb the foreign key constraints just won&#8217;t get created on the database. I spent a whole evening trying to figure out what I might be doing wrong since everythign seemed to be perfectly alright. Finally I found the culprit after reading through <a href="http://dev.mysql.com/doc/refman/5.0/en/create-table.html" target="_blank">MySQL Documentation</a>.</p>
<h3 class="title" style="padding-left:30px;"><em>Important</em></h3>
<p style="padding-left:30px;"><em> The inline <code>REFERENCES</code> specifications               where the references are defined as part of the column               specification are silently ignored by               <code>InnoDB</code>. InnoDB only accepts               <code>REFERENCES</code> clauses when specified as               part of a separate <code>FOREIGN KEY</code> specification.</em></p>
<p>I am not really sure whose fault it should be. As a user I would either want</p>
<p>a) MySQL to throw errors.</p>
<p>OR</p>
<p>b) Django to generate the format that MySQL would really use and not just ignore.</p>
<p>I am not sure how many django developers who use MySQL really know that this is the case. If not for me using mysql in linux which defaults to using myISAM and my histrionics to make the app use InnoDB, I probably wouldnt have checked or delved deep into this.</p>
<p>I need to check if there is a ticket in django already for this. If not maybe this is probably the first patch I can work on for django.</p>
<p>Anyways, I ended up using sqlall to generate the sql statements and store it in a file and parse the file to create the alter table commands. I have put this as a <a href="http://www.djangosnippets.org/snippets/808/" target="_blank">django snippet</a> in case anyone is as lazy as me to write the alter table commands manually.</p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/vidyanand.wordpress.com/10/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/vidyanand.wordpress.com/10/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/vidyanand.wordpress.com/10/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/vidyanand.wordpress.com/10/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/vidyanand.wordpress.com/10/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/vidyanand.wordpress.com/10/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/vidyanand.wordpress.com/10/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/vidyanand.wordpress.com/10/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/vidyanand.wordpress.com/10/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/vidyanand.wordpress.com/10/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/vidyanand.wordpress.com/10/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/vidyanand.wordpress.com/10/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=vidyanand.wordpress.com&blog=37367&post=10&subd=vidyanand&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://vidyanand.wordpress.com/2008/06/16/is-it-a-mysql-or-django-fault/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/a2b8e67230992af236ff7a5279457de4?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">vidyanand</media:title>
		</media:content>
	</item>
		<item>
		<title>Just when you thought you have seen it all</title>
		<link>http://vidyanand.wordpress.com/2006/10/30/just-when-you-thought-you-have-seen-it-all/</link>
		<comments>http://vidyanand.wordpress.com/2006/10/30/just-when-you-thought-you-have-seen-it-all/#comments</comments>
		<pubDate>Mon, 30 Oct 2006 13:05:46 +0000</pubDate>
		<dc:creator>vidyanand</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://vidyanand.wordpress.com/2006/10/30/just-when-you-thought-you-have-seen-it-all/</guid>
		<description><![CDATA[1. Ferrari has engine problems !!!!!!!
2. Rossi Crashes !!!!!!!!!!!!!
       <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=vidyanand.wordpress.com&blog=37367&post=3&subd=vidyanand&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>1. Ferrari has engine problems !!!!!!!</p>
<p>2. Rossi Crashes !!!!!!!!!!!!!</p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/vidyanand.wordpress.com/3/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/vidyanand.wordpress.com/3/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/vidyanand.wordpress.com/3/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/vidyanand.wordpress.com/3/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/vidyanand.wordpress.com/3/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/vidyanand.wordpress.com/3/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/vidyanand.wordpress.com/3/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/vidyanand.wordpress.com/3/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/vidyanand.wordpress.com/3/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/vidyanand.wordpress.com/3/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/vidyanand.wordpress.com/3/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/vidyanand.wordpress.com/3/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=vidyanand.wordpress.com&blog=37367&post=3&subd=vidyanand&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://vidyanand.wordpress.com/2006/10/30/just-when-you-thought-you-have-seen-it-all/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/a2b8e67230992af236ff7a5279457de4?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">vidyanand</media:title>
		</media:content>
	</item>
	</channel>
</rss>