bindparam documentation is wrong

Issue #1387 resolved
Former user created an issue

Documentation for bindparam looks like this:

session.execute(select_statement, binding1=value1, binding2=value2)

It should look like this:

session.execute(select_statement, params=dict(binding1=value1, binding2=value2))

This particular bit of bad documentation cost me about 1.5 hours last night to try to fix. I'll try to submit a patch for it soon.

Comments (1)

  1. Mike Bayer repo owner

    Sorry I can't locate where you're seeing that documentation. There is only one section of the docs I can find which have examples for Session.execute(), at http://www.sqlalchemy.org/docs/05/session.html#using-sql-expressions-with-sessions , and the examples are correct:

    result = session.execute("select * from table where id=:id", {'id':7})
    
    result = session.execute("select * from table where id=:id", {'id':7}, mapper=MyMappedClass)
    

    note that the signature for Session.execute is different than that of a straight connectable (i.e. Engine or Connection) so you may be confusing the two different sub-libraries.

  2. Log in to comment