_tuple() is fine,
Thanks Michael :-)
j

Michael Bayer wrote:
On Jan 3, 2013, at 2:40 AM, jo wrote:

Hi all,

I need to use in_(), but in oracle it has a limit of 1000 values,
there's an alternative syntax that can be used successful in oracle and it is:
(field,-1) in ( (123,-1), (333,-1), ... )

I tryed this:
session.query(Mytable).filter((Mytable.c.id,-1).in_([(123,-1),(333,-1)]) )

AttributeError: 'tuple' object has no attribute 'in_'

How can I use this syntax with sa?


I usually handle the Oracle 1000 value limit by running the same query multiple 
times, then merging in memory.

But if you want to do (a, b) IN ((x1, y1), (x2, y2), ...) there's a construct 
called tuple_() that should do it:

from sqlalchemy import tuple_
print tuple_(mytable.c.id, -1).in_([tuple_(1, -1), tuple_(2, -1)])
(t.x, :param_1) IN ((:param_2, :param_3), (:param_4, :param_5))




--
Jose Soares Da Silva                     _/_/
Sferacarta Net
Via Bazzanese 69                       _/_/    _/_/_/
40033 Casalecchio di Reno             _/_/  _/_/  _/_/
Bologna - Italy                      _/_/  _/_/  _/_/
Ph  +39051591054              _/_/  _/_/  _/_/  _/_/
fax +390516131537            _/_/  _/_/  _/_/  _/_/
web:www.sferacarta.com        _/_/_/      _/_/_/

Le informazioni contenute nella presente mail ed in ogni eventuale file 
allegato sono riservate e, comunque, destinate esclusivamente alla persona o 
ente sopraindicati, ai sensi del decreto legislativo 30 giugno 2003, n. 196. La 
diffusione, distribuzione e/o copiatura della mail trasmessa, da parte di 
qualsiasi soggetto diverso dal destinatario, sono vietate. La correttezza, 
l’integrità e la sicurezza della presente mail non possono essere garantite. Se 
avete ricevuto questa mail per errore, Vi preghiamo di contattarci 
immediatamente e di eliminarla. Grazie.

This communication is intended only for use by the addressee, pursuant to 
legislative decree 30 June 2003, n. 196. It may contain confidential or 
privileged information. You should not copy or use it to disclose its contents 
to any other person. Transmission cannot be guaranteed to be error-free, 
complete and secure. If you are not the intended recipient and receive this 
communication unintentionally, please inform us immediately and then delete 
this message from your system. Thank you.

--
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To post to this group, send email to sqlalchemy@googlegroups.com.
To unsubscribe from this group, send email to 
sqlalchemy+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en.

Reply via email to