On May 7, 2008, at 3:01 PM, sbhatt wrote:

> But I want to run the query based on the arguments provided to the
> function, where in the list [1,2,3,4] will be passed in as an argument
> as studentidlist = [1,2,3,4]. Hence when I write the following query ,
> it throws me a SQLError: (DatabaseError) ORA-01484: arrays can only be
> bound to PL/SQL statements
> session.query(Student).filter(Student.c.studentid.in_(studentidlist))
>
> Currently I am using a workaround to first generate a string criteria
> looping over each element in the list, then use this criteria to
> execute query
> studentidlist = [1,2,3,4]
> str_criteria = "studentid in (1,2,3,4)"
> session.query(Student).filter(str_criteria).all()

the format of your studentidlist is possibly incorrect.  make sure you  
arent passing something like [[1,2,3,4]] or [[1], [2], [3], [4]] to  
it.   Also make sure you're on version 0.4 of SQLAlchemy, as version  
0.3 accepted in_() argument using only the varargs style in_(*args).



--~--~---------~--~----~------------~-------~--~----~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to