create "singleton bind param", distinguish from current bind parameter

Issue #327 resolved
Mike Bayer repo owner created an issue

this is an intuitive pattern that currently does not work:

  s = table.select(and_(table.c.id==bindparam('id'), table.c.otherid==bindparam('id')))
  s.execute(id=5)

because there are two separate BindParamClause instances. The BindParamClause that is implicitly generated in SQL construction should retain its current behavior, since it relies upon each separate bind param having its "key" modified at compilation time as well as the embedded "value". but the default bindparam function should produce an immutable "singleton" BindParamClause, perhaps by returning the same instance for the same key. the "singleton" bindparam should probably not accept a value. the "bindparam" that takes a value should be called something like value_bindparam().

Comments (2)

  1. Log in to comment