On 3/30/06, Gregory P. Smith <greg@electricrain.com> wrote:
> Getting off on a tangent here, but I would actually
> like some decent way of writing SQL queries in Python --
> not for importing, but for database access.
>
> Constructing bits of SQL out of character strings
> sucks *extremely* badly.

Have you looked at SqlObject?  (and its associated modules
sqlobject.sqlbuilder in particular)

SQLAlchemy (www.sqlalchemy.org ) is also nice, in particular for more complex setups. I found it scales much better to the insanely complex SQL queries that our home-grown PostgreSQL/Perl setup needs, and it handles transactions the same way as our home-grown ORM too. There's plenty of ways to reliably and sanely avoid typing actual SQL in Python.

--
Thomas Wouters <thomas@python.org>

Hi! I'm a .signature virus! copy me into your .signature file to help me spread!