<?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/"
		>
<channel>
	<title>Comments on: Django multiple database support with DB switch feature</title>
	<atom:link href="http://www.meszaros.cz/2009/10/django-multiple-database-support-with-db-switch-feature/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.meszaros.cz/2009/10/django-multiple-database-support-with-db-switch-feature/</link>
	<description>reflections on technology and society</description>
	<lastBuildDate>Tue, 20 Jul 2010 23:40:27 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
	<item>
		<title>By: admin</title>
		<link>http://www.meszaros.cz/2009/10/django-multiple-database-support-with-db-switch-feature/comment-page-1/#comment-21</link>
		<dc:creator>admin</dc:creator>
		<pubDate>Fri, 27 Nov 2009 09:36:58 +0000</pubDate>
		<guid isPermaLink="false">http://www.meszaros.cz/?p=51#comment-21</guid>
		<description>Yes, I am able to do that. The first condition is not to use foreign key constraints in the first table with foreign key on database level. This is apparent for MySQL MyISAM engine. If you use any other engine or any other DB backend, Django will implicitly try to create foreign key constraint. In that case, it is better to create the table manually with the foreign key column of simple integer type without any constraints. The other table, living in another database, must be defined as regular django model, which inherits from your custom overriden &quot;django.db.models.Model&quot; class. The overriden class must be using a custom &quot;Manager&quot;, which i simply overriden &quot;django.db.models.Manager&quot; class. 
If you want to perform SELECT or UPDATE commands on another database tables, you have to override the &quot;get_query_set&quot; method in your custom manager. If you also want do perform INSERT commands, you have to override the &quot;_insert&quot; method too.
For detailed how-to, please follow this link: http://djangrrl.com/view/multiple-database-connection-a-simple-use-case/</description>
		<content:encoded><![CDATA[<p>Yes, I am able to do that. The first condition is not to use foreign key constraints in the first table with foreign key on database level. This is apparent for MySQL MyISAM engine. If you use any other engine or any other DB backend, Django will implicitly try to create foreign key constraint. In that case, it is better to create the table manually with the foreign key column of simple integer type without any constraints. The other table, living in another database, must be defined as regular django model, which inherits from your custom overriden &#8220;django.db.models.Model&#8221; class. The overriden class must be using a custom &#8220;Manager&#8221;, which i simply overriden &#8220;django.db.models.Manager&#8221; class.<br />
If you want to perform SELECT or UPDATE commands on another database tables, you have to override the &#8220;get_query_set&#8221; method in your custom manager. If you also want do perform INSERT commands, you have to override the &#8220;_insert&#8221; method too.<br />
For detailed how-to, please follow this link: <a href="http://djangrrl.com/view/multiple-database-connection-a-simple-use-case/" rel="nofollow">http://djangrrl.com/view/multiple-database-connection-a-simple-use-case/</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Malik Ehsanullah</title>
		<link>http://www.meszaros.cz/2009/10/django-multiple-database-support-with-db-switch-feature/comment-page-1/#comment-20</link>
		<dc:creator>Malik Ehsanullah</dc:creator>
		<pubDate>Thu, 26 Nov 2009 11:17:08 +0000</pubDate>
		<guid isPermaLink="false">http://www.meszaros.cz/?p=51#comment-20</guid>
		<description>Are you able to access Foreign Key in a table which points to some other table which is present in some other database.</description>
		<content:encoded><![CDATA[<p>Are you able to access Foreign Key in a table which points to some other table which is present in some other database.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
