Connecting SQLObjects to PostgreSQL via SSL


I’m trying to learn TurboGears, but I got stumped yesterday trying to figure out how to connect to PostgreSQL via SSL.

Turns out this works in SQLObject (TurboGear’s default ORM):

sqlobject.dburi="postgres://username:pass@servername/mydb sslmode=require"

Turns out the syntax I was trying to use works with SQLAlchemy (which it appears most cool kids use):


Notice the only difference is the question mark between the database and extra parameters. Kind of makes me want to cry…

To all my friends who have listened to me extol the virtues of Python, let me also add that learning a new framework sucks. Especially when that framework is a moving target.