[Sqlalchemy-tickets] Issue #4271: support empty list with expanding IN (zzzeek/sqlalchemy)
Brought to you by:
zzzeek
From: Michael B. <iss...@bi...> - 2018-06-06 14:49:24
|
New issue 4271: support empty list with expanding IN https://bitbucket.org/zzzeek/sqlalchemy/issues/4271/support-empty-list-with-expanding-in Michael Bayer: e.g. ``` #!python def test_empty_set(self): table = self.tables.some_table stmt = select([table.c.id]).where( table.c.x.in_(bindparam('q', expanding=True))).order_by(table.c.id) self._assert_result( stmt, [], params={"q": []}, ) ``` right now this doesn't work due to: ``` #!python raise exc.InvalidRequestError( "'expanding' parameters can't be used with an " "empty list" ) ``` e.g. we are still outputting bound parameter markers. per the discussion at https://groups.google.com/forum/#!topic/sqlalchemy/NLJCu_vqK4g we can inject SQL expressions that essentially represent empty sets - for all dialects where we can get consistent behavior we can turn this on. if for example Oracle just won't behave the same way we can mark it as not supported, but for the sqlite/mysql/pg case this should be feasible. ongoing work at https://gerrit.sqlalchemy.org/#/c/zzzeek/sqlalchemy/+/760/. |