Re: [SQLObject] SQLObject Database connection
SQLObject is a Python ORM.
Brought to you by:
ianbicking,
phd
From: Sam N. <sa...@se...> - 2004-12-26 08:11:30
|
Hong Yuan wrote: > I am using SQLObject with a PostgreSQL database. Part of my program uses > SQLObject to access the database, part of it uses psycopg directly. > > The question is, do I have to initiailze two separate database > connections, one with psycopg.connect for my own code, and another with > connectionForURI('postgres://...') for use with SQLObject? > > Can I create a connectino for SQLObject from an existing psycopg > connection of vice versa, get an psycopg connection back from an > SQLObject connection object? > > Greetings, > Here is a simplified version of how I am handling this. If I have an SQLObject class called Image then: sqlstring = "SELECT id FROM imagelist" imagelist = Image._connection.queryAll(sqlstring) idlist = [row[0] for row in imagelist] print "list: ", idlist return idlist Good Luck! - Sam Nilsson |