Hi all,

I'm hitting what is either a regression or a "deprecated" usage of PG
ARRAY's any() method, trying to upgrade an app of mine from SA 1.4.35 to
SA 1.4.36.

The issue is within a quite complex query, with a filter expression like
the following:

  query = query.filter(((CC.languages == None) | 
CC.languages.any(sa.bindparam('language'))))

where CC.languages is a sqlalchemy.dialects.postgresql.ARRAY(UnicodeText()) 
column,
and the language bindparam is the two-letter code of a language, say
"it" or "en".

That query works great since years in production using SA 1.3, and also
in my work-in-progress dev branch using 1.4.x, producing something like

  ...
  AND (cc.languages IS NULL OR %(language)s = ANY (cc.languages))
  ...

Today I tried to upgrade the dev branch to SA 1.4.36 and several tests
failed, because that filter is rendered as

  ...
  AND (cc.languages IS NULL OR %(language)s::TEXT[] = ANY (cc.languages))
  ...

In the note that follows
https://docs.sqlalchemy.org/en/14/core/type_basics.html#sqlalchemy.types.ARRAY.Comparator.any
I read that the any() method "is superceded by" the any_() function, so
maybe that's what I should do... but given that the above idiom has
worked well for me for so long, this may very well be an unintended
side effect of 
https://github.com/sqlalchemy/sqlalchemy/commit/63191fbef63ebfbf57e7b66bd6529305fc62c605.

Thank you for any hint,
ciao, lele.
-- 
nickname: Lele Gaifax | Dire che Emacs è "conveniente" è come
real: Emanuele Gaifas | etichettare l'ossigeno come "utile"
l...@etour.tn.it      |                           -- Rens Troost

-- 
SQLAlchemy - 
The Python SQL Toolkit and Object Relational Mapper

http://www.sqlalchemy.org/

To post example code, please provide an MCVE: Minimal, Complete, and Verifiable 
Example.  See  http://stackoverflow.com/help/mcve for a full description.
--- 
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sqlalchemy+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sqlalchemy/87bkwjpzl0.fsf%40metapensiero.it.

Reply via email to