<?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/"
	>

<channel>
	<title>Python Blog - All about python &#187; Django</title>
	<atom:link href="http://www.python-blog.com/tag/django/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.python-blog.com</link>
	<description>and technologies around</description>
	<lastBuildDate>Tue, 27 Jul 2010 19:58:17 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Python logging &#8211; simpler than ever</title>
		<link>http://www.python-blog.com/2009/11/09/python-logging-simpler-than-ever/</link>
		<comments>http://www.python-blog.com/2009/11/09/python-logging-simpler-than-ever/#comments</comments>
		<pubDate>Mon, 09 Nov 2009 10:07:04 +0000</pubDate>
		<dc:creator>Łukasz Balcerzak</dc:creator>
				<category><![CDATA[Python]]></category>
		<category><![CDATA[Django]]></category>
		<category><![CDATA[orm]]></category>
		<category><![CDATA[python blog]]></category>

		<guid isPermaLink="false">http://www.python-blog.com/?p=202</guid>
		<description><![CDATA[During the weekend I&#8217;ve created Djalog project hosted at the http://code.google.com/p/djalog/. It is simplest possible logging app aimed to work within Django context (or for prototyping as it is also logging-ready out of the box after import in any scripts). 
I&#8217;ve also put it on the PyPi (http://pypi.python.org/pypi/Djalog) so in order to install it you [...]]]></description>
			<content:encoded><![CDATA[<p>During the weekend I&#8217;ve created Djalog project hosted at the http://code.google.com/p/djalog/. It is simplest possible logging app aimed to work within Django context (or for prototyping as it is also logging-ready out of the box after import in any scripts). </p>
<p>I&#8217;ve also put it on the PyPi (http://pypi.python.org/pypi/Djalog) so in order to install it you would execute:</p>
<pre class="brush:python">
easy_install Djalog
</pre>
<p>and you are ready. If you want to quickly check how it works just type:</p>
<pre class="brush:python">
import djalog
import logging

logging.debug("Log some debug information.")
logging.info("Log some information.")
logging.warn("Log some warning.")
logging.error("Log some error.")
logging.critical("Log some critical information.")

from djalog import configure
configure(LOG_USE_COLORS=True, LOG_SQL=True, LOG_LEVEL=5)

logging.debug("Log some debug information.")
logging.info("Log some information.")
logging.warn("Log some warning.")
logging.error("Log some error.")
logging.critical("Log some critical information.")

# Log sql query
logging.sql("SELECT * FROM users WHERE username = 'admin'")
</pre>
<p>This is beta but it should be changed to &#8220;final&#8221; in two weeks. Remember that you may update projects from CheeseShop using &#8220;-U&#8221; option:</p>
<pre class="brush:python">
easy_install -U Djalog
</pre>
<p>Enjoy!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.python-blog.com/2009/11/09/python-logging-simpler-than-ever/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>SQLAlchemy: give me my Session object!</title>
		<link>http://www.python-blog.com/2009/10/21/sqlalchemy-give-me-my-session-object/</link>
		<comments>http://www.python-blog.com/2009/10/21/sqlalchemy-give-me-my-session-object/#comments</comments>
		<pubDate>Wed, 21 Oct 2009 09:34:44 +0000</pubDate>
		<dc:creator>Łukasz Balcerzak</dc:creator>
				<category><![CDATA[Python]]></category>
		<category><![CDATA[Django]]></category>
		<category><![CDATA[integer]]></category>
		<category><![CDATA[model]]></category>
		<category><![CDATA[orm]]></category>
		<category><![CDATA[problem]]></category>
		<category><![CDATA[python blog]]></category>
		<category><![CDATA[SqlAlchemy]]></category>

		<guid isPermaLink="false">http://www.python-blog.com/?p=197</guid>
		<description><![CDATA[While I love many things about SQLAlchemy this was something I just missed sooooo much &#8211; defining model&#8217;s methods without having to pass session object.
While using Django ORM for such action it is extra easy as there is no session objects at all (well, there is connection object but it&#8217;s much simpler and less sophisticated).
Assume [...]]]></description>
			<content:encoded><![CDATA[<p>While I love many things about SQLAlchemy this was something I just missed sooooo much &#8211; defining model&#8217;s methods without having to pass session object.<br />
While using Django ORM for such action it is extra easy as there is no session objects at all (well, there is connection object but it&#8217;s much simpler and less sophisticated).<br />
Assume you have BlogEntry and BlogComment mappers and you want to define function at entry model which returns related comments &#8211; I know, it is as simple as it could be, but it&#8217;s only an example.</p>
<pre class="brush:python">
class BlogEntry(Base):
    __tablename__ = 'blog_entry'

    title = Column(String)
    content = Column(Text)
    created_at = Column(DateTime, default=datetime.datetime.now)

    def __repr__(self):
        return self.title

class BlogComment(Base):
    __tablename__ = 'blog_comment'

    content = Column(Text)
    created_at = Column(DateTime, default=datetime.datetime.now)
    entry_id = Column(Integer, ForeignKey('blog_entry.id'))
    entry = relation('BlogEntry',
        primaryjoin='BlogEntry.id==BlogComment.entry_id',
        backref='comment_set')
</pre>
<p>You now can of course get comments using comment_set attribute on blog entry. But sometimes we want start querying for other objects, for some reasons.<br />
With Django ORM, no problem, just define method on the model and start querying &#8211; it just works. With SQLAlchemy on the other hand we need to create query<br />
using Session object. But how does mapper use proper session if you call &#8216;comment_set&#8217;? Well, I&#8217;ve found the answer here: http://www.sqlalchemy.org/docs/05/reference/orm/sessions.html . There is &#8216;Session.object_session&#8217; class method which returns session object binded to an model object.</p>
<p>So now we can simply define method for BlogComment:</p>
<pre class="brush:python">
    def get_related_comments(self):
        session = Session.object_session(self)
        comment_list = session.query(BlogComment)\
            .filter(BlogComment.entry_id==BlogEntry.id)\
            .all()
        return comment_list
</pre>
<p>Just remember that object which is passed to &#8216;Session.object_session&#8217; method has to be binded with some session first.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.python-blog.com/2009/10/21/sqlalchemy-give-me-my-session-object/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Lightweight Version Control Browser for Python</title>
		<link>http://www.python-blog.com/2009/10/09/lightweight-version-control-browser-for-python/</link>
		<comments>http://www.python-blog.com/2009/10/09/lightweight-version-control-browser-for-python/#comments</comments>
		<pubDate>Fri, 09 Oct 2009 21:46:47 +0000</pubDate>
		<dc:creator>Łukasz Balcerzak</dc:creator>
				<category><![CDATA[Python]]></category>
		<category><![CDATA[Django]]></category>
		<category><![CDATA[python blog]]></category>

		<guid isPermaLink="false">http://www.python-blog.com/?p=185</guid>
		<description><![CDATA[Finally, I have released my second python project. It is small toolkit for browsing repositories (only svn is supported now) in simple way.
You can find it here: Version Control Browser.
A while ago I started to create django based, software management tracking project. I wanted to implement something similar to the browser from Trac. Long story, [...]]]></description>
			<content:encoded><![CDATA[<p>Finally, I have released my second python project. It is small toolkit for browsing repositories (only svn is supported now) in simple way.<br />
You can find it here: <a href="http://code.google.com/p/python-vcbrowser">Version Control Browser</a>.</p>
<p>A while ago I started to create django based, software management tracking project. I wanted to implement something similar to the browser from <a href="http://trac.edgewall.org/">Trac</a>. Long story, short &#8211; I&#8217;ve reorganized codes and ended up with needs of Django-independant repositories browsing library. There are some modules available right now but most of them focus on mirroring commit/update/pull/push commands &#8211; not on browsing which is much easier and should be more lightweight in my opinion.</p>
<p>If anyone who reads this would like to help me with the project &#8211; let me know.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.python-blog.com/2009/10/09/lightweight-version-control-browser-for-python/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Sql alchemy model generator</title>
		<link>http://www.python-blog.com/2009/09/26/sql-alchemy-model-generator/</link>
		<comments>http://www.python-blog.com/2009/09/26/sql-alchemy-model-generator/#comments</comments>
		<pubDate>Sat, 26 Sep 2009 10:53:28 +0000</pubDate>
		<dc:creator>Marcin Kuźmiński</dc:creator>
				<category><![CDATA[Django]]></category>
		<category><![CDATA[Pylons]]></category>
		<category><![CDATA[SqlAlchemy]]></category>
		<category><![CDATA[autoload]]></category>
		<category><![CDATA[django-alchemy]]></category>
		<category><![CDATA[generator]]></category>
		<category><![CDATA[IDE]]></category>
		<category><![CDATA[model]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[python blog]]></category>
		<category><![CDATA[sql alchemy]]></category>

		<guid isPermaLink="false">http://www.python-blog.com/?p=134</guid>
		<description><![CDATA[Recently i had to create a lot of models using declarative mode with sqlalchemy 0.5.5 It was very time consuming especially for large databases. I started to think about an automated solution.
Sqlalchemy have this auto load feature which fetches info about tables by itself. I wanted to use this somehow to generate a string which [...]]]></description>
			<content:encoded><![CDATA[<p>Recently i had to create a lot of models using declarative mode with sqlalchemy 0.5.5 It was very time consuming especially for large databases. I started to think about an automated solution.</p>
<p>Sqlalchemy have this auto load feature which fetches info about tables by itself. I wanted to use this somehow to generate a string which can be easily  copy/paste to database model definition script. So i started a little project to write auto  model generator for sql alchemy based on auto load feature in sqlalchemy.</p>
<p>The script  is not perfect but it works and save a huge amount of time just codding the models. In fact is was able to setup a 186 table database model in 15minutes with this script.</p>
<p>Well the script helped me a lot and now on when i have to load some new existing database or changes i use it all the time.</p>
<p>The documentation is inside the script i tried to write it so anybody could use it out of the box.</p>
<p>I tested it on 4 schema 200+ tables database and i worked quite good. This script still have to be polished but current functionality is enough for most users.</p>
<p>My script is going to be also a part of django-alchemy project started by my friend Lukasz Balcerzak. You can visit the project site @ <a href="http://code.google.com/p/django-alchemy/">http://code.google.com/p/django-alchemy/</a></p>
<p>I used it with Pylons application and Django with modded sqlalchemy. but it can be basically used in any app which uses sqlalchemy. I did not test it with mysql though,but it should work, just specify mysql as dialect.</p>
<p><span style="font-size:130%"><strong>You can download this script from <a href="http://www.python-blog.com/wp-content/uploads/2009/09/base_model_generator.py">sqlalchemy model generator</a></strong></span></p>
]]></content:encoded>
			<wfw:commentRss>http://www.python-blog.com/2009/09/26/sql-alchemy-model-generator/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>django and sqlachemy integration</title>
		<link>http://www.python-blog.com/2009/09/05/django-and-sqlachemy-integration/</link>
		<comments>http://www.python-blog.com/2009/09/05/django-and-sqlachemy-integration/#comments</comments>
		<pubDate>Sat, 05 Sep 2009 16:45:44 +0000</pubDate>
		<dc:creator>Marcin Kuźmiński</dc:creator>
				<category><![CDATA[Django]]></category>
		<category><![CDATA[SqlAlchemy]]></category>
		<category><![CDATA[django-alchemy]]></category>
		<category><![CDATA[IDE]]></category>
		<category><![CDATA[integration]]></category>
		<category><![CDATA[multiple database]]></category>
		<category><![CDATA[orm]]></category>
		<category><![CDATA[python blog]]></category>

		<guid isPermaLink="false">http://www.python-blog.com/?p=158</guid>
		<description><![CDATA[One of my friends started an interesting project to integrate sqlalchemy into Django. Project name is django-alchemy.
You can visit it on Google code under http://code.google.com/p/django-alchemy/.
You may ask why to use sqlalchemy under Django if it already have an ORM ?
It&#8217;s very easy the django orm is not always the best choice. When using multiple schemas, [...]]]></description>
			<content:encoded><![CDATA[<p>One of my friends started an interesting project to integrate sqlalchemy into Django. Project name is django-alchemy.<br />
You can visit it on Google code under <a href="http://code.google.com/p/django-alchemy/">http://code.google.com/p/django-alchemy/</a>.</p>
<p>You may ask why to use sqlalchemy under Django if it already have an ORM ?<br />
It&#8217;s very easy the django orm is not always the best choice. When using multiple schemas, or multiple database connection the Django ORM just does not provide such functionality.<br />
SqlAlchemy have this built in so when you&#8217;re thinking of using multiple schemas or databases in your django project check out his project. Highly recommended</p>
]]></content:encoded>
			<wfw:commentRss>http://www.python-blog.com/2009/09/05/django-and-sqlachemy-integration/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Django 1.1 finally released!</title>
		<link>http://www.python-blog.com/2009/07/29/django-1-1-finally-released/</link>
		<comments>http://www.python-blog.com/2009/07/29/django-1-1-finally-released/#comments</comments>
		<pubDate>Wed, 29 Jul 2009 19:53:51 +0000</pubDate>
		<dc:creator>Łukasz Balcerzak</dc:creator>
				<category><![CDATA[Django]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[orm]]></category>
		<category><![CDATA[python blog]]></category>
		<category><![CDATA[SqlAlchemy]]></category>

		<guid isPermaLink="false">http://www.python-blog.com/?p=131</guid>
		<description><![CDATA[With almost 4 months late here it comes, Django 1.1. I&#8217;ve been waiting to see this at the final stage, as we use Django in our company, and I was sometimes forced to code down things that are already boundled now, like sql aggregation functionality for instance (well, in fact I just wrote a little [...]]]></description>
			<content:encoded><![CDATA[<p>With almost 4 months late here it comes, Django 1.1. I&#8217;ve been waiting to see this at the final stage, as we use Django in our company, and I was sometimes forced to code down things that are already boundled now, like sql aggregation functionality for instance (well, in fact I just wrote a little django app using full force of SQLAlchemy instead of Django ORM). Additionally, some security patch was released yesterday, which is included with 1.1 too.</p>
<p>You may read more at <a href="http://docs.djangoproject.com/en/dev/releases/1.1/">release notes</a> page . Stay tuned with Django and minor swing ;-) </p>
]]></content:encoded>
			<wfw:commentRss>http://www.python-blog.com/2009/07/29/django-1-1-finally-released/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
