[Grok-dev] Grok and PostgreSQL, where do I start?

Brandon Craig Rhodes brandon at rhodesmill.org
Tue Dec 18 13:53:00 EST 2007


Peter Bengtsson <peter at fry-it.com> writes:

> That's great. I don't understand it but it looks like there's light
> at the end of that tunnel if I read the manual.  For the particular
> problem I'm facing today I might just do my own import psycopg'
> since there is no model to talk about here and the tables already
> exist in a running database.

Oh, that makes things easy!  If all you want to do is present objects
on the web that you already know how to get through Python (like doing
your own "import psycopg" and some queries), you might find this
tutorial helpful:

   http://grok.zope.org/minitutorials/transient-objects.html

I ought to write a little tutorial about just using nearly-bare
psycopg2 with Grok, for those who (unlike me) don't need or want to
wrap fancy object models around their legacy databases.  The main
thing I would include in it is how to use psycopg's native connection
pooling; how to let your Grok app rely on configuration from outside
of the code itself (so that your development instance and production
instance can point to different databases, for example); and how to
make sure things get committed when a web transaction completes.

-- 
Brandon Craig Rhodes   brandon at rhodesmill.org   http://rhodesmill.org/brandon


More information about the Grok-dev mailing list