expanding parameter

Issue #3953 resolved
Mike Bayer repo owner created an issue

this is for the purpose of IN() in conjunction with query caching. Idea is to allow this to be viable with "select in" loading and "select in" inheritance so that these are compatible w/ "baked".

stmt = select([table]).where(table.c.col.in_(bindparam('foo', expanding=True))
conn.execute(stmt, {"foo": [1, 2, 3]})

the string statement is converted at ExecutionContext time with an extra search and replace. this so that all the caching steps can be used against the above query w/ a dynamic list for IN.

Comments (1)

  1. Mike Bayer reporter

    Add new "expanding" feature to bindparam()

    Added a new kind of :func:.bindparam called "expanding". This is for use in IN expressions where the list of elements is rendered into individual bound parameters at statement execution time, rather than at statement compilation time. This allows both a single bound parameter name to be linked to an IN expression of multiple elements, as well as allows query caching to be used with IN expressions. The new feature allows the related features of "select in" loading and "polymorphic in" loading to make use of the baked query extension to reduce call overhead. This feature should be considered to be experimental for 1.2.

    Fixes: #3953 Change-Id: Ie708414a3ab9c0af29998a2c7f239ff7633b1f6e

    → <<cset 7d9f241d63b7>>

  2. Log in to comment