[PEAK] bulletins example OF DOOM

Phillip J. Eby pje at telecommunity.com
Fri Apr 9 10:56:37 EDT 2004

At 03:29 AM 4/9/04 -0400, Stephen Waterbury wrote:
>I modified GenericSQL_URL to include a 'pypgsql' scheme
>(see attached version of SQL.py) and added a pyPgSQLConnection
>(just a copy of the PsycopgConnection with the DRIVER changed
>to "pyPgSQL.PgSQL" -- probably close enough for now).  Since
>I use PostgreSQL on a domain socket, there is no 'host', so I
>changed the server attribute to just 'Field' instead of
>'RequiredField' (which IMO seems more correct, since 'host' is
>an optional connection parameter according to the DBAPI spec).
>Then I messed around with 'syntax' (somewhat blindly ...
>oh, okay, totally blindly :) until I got the traceback I've
>included below.  Seems to me like this should work, BUT NO!
>Ach.  I feel like I'm really close but still missing something.

You used this syntax:

('//',), (user, (':', passwd), '@'), (server,), ('/', db,)

Which means, "optional // followed by optional user:pw@ clause, followed by 
optional server, optionally followed by a '/',db pair.  I think you might 
actually want something closer to this:

('//',), ((user, (':', passwd), '@'), server), '/', db,

which means, "optional // followed by an optional [user[:pw]@]server 
clause, followed by a required / and DB.

(Tuples in the syntax are translated to "optional" parts.  Nested tuples 
indicate optional within the optional.)

More information about the PEAK mailing list