Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

expanding parameter #3953

Closed
sqlalchemy-bot opened this issue Apr 3, 2017 · 2 comments
Closed

expanding parameter #3953

sqlalchemy-bot opened this issue Apr 3, 2017 · 2 comments
Milestone

Comments

@sqlalchemy-bot
Copy link
Collaborator

Migrated issue, originally created by Michael Bayer (@zzzeek)

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.

@sqlalchemy-bot
Copy link
Collaborator Author

Michael Bayer (@zzzeek) wrote:

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

7d9f241

@sqlalchemy-bot
Copy link
Collaborator Author

Changes by Michael Bayer (@zzzeek):

  • changed status to closed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant