[Twisted-Python] problems w/ pyPgSQL and the Enterprise HOWTO

Andrew Bennetts andrew-twisted at puzzling.org
Sun Feb 23 21:44:21 EST 2003


On Sun, Feb 23, 2003 at 05:52:37PM -0600, Justin Ryan wrote:
> Hiya all,
> 
> I'm playing around with the basics of Twisted.Enterprise, and am having
> some trouble.  I seem to have fixed it, but am unsure why the example in
> the howto ( http://twistedmatrix.com/documents/howto/enterprise ) did
> not work off the bat.  I'm using pyPgSQL to connect to postgres.  Here
> goes:
> 
> The howto suggests:
> 
> <- snip ->
> 
> class AgeDatabase(adbapi.Augmentation):
>      def getAge(self, name):
>          sql = """SELECT Age FROM People WHERE name = ?"""
>          return self.runQuery(sql, name)
> 
> <- snip ->

The howto also says:
    Also worth noting is that this example assumes that dbmodule uses the
    qmarks paramstyle (see the DB-API specification).

This is the cause of the problem; pyPgSQL uses a different paramstyle.  

Maybe this should be made clearer, by inserting a 
        # Assumes dbmodule.paramstyle == 'qmarks'
into the example code, where people will read it.

> Is this a problem with pyPgSQL? something else? pyPgSQL is the
> _recommended_ module in the enterprise howto, so I didn't expect to run
> into trouble with it..

Yeah, that is a good point.  The howto should probably use examples that
work with pyPgSQL, to save confusion.

-Andrew.





More information about the Twisted-Python mailing list