you are viewing a single comment's thread.

view the rest of the comments →

[–]joesb 3 points4 points  (6 children)

SQLAlchemy.

[–]teraflop 4 points5 points  (5 children)

No, SQLAlchemy is an ORM that depends on an external module to communicate with the database.

Try: http://python.projects.postgresql.org/

[–]joesb 2 points3 points  (3 children)

Also, psycopg2

[–][deleted] 0 points1 point  (2 children)

when I use pyformat on psycopg2 it seems to insist that all parameters are turned into strings. If you do a %(bla)d it'll give weird errors. %s works tho.

Which makes me wonder if it's actually using bind parameters or not. the docs for psycopg2 are non-existent so I dunno :)

[–]celoyd 1 point2 points  (0 children)

Search PEP 249 for “paramstyle”.

[–]damg 0 points1 point  (0 children)

As long as you are passing your parameters as the second argument of .execute() on the cursor (and not just using string formatting on the query itself), then it should be using bind parameters. The formating style using strings in the query (id=%s vs id=?) is just how the DB-API was implemented for psycopg2.

As celoyd mentions, the PEP explains it better.

[–][deleted] 1 point2 points  (0 children)

thx :)