Thanks for the help I was trying to make the code run on both 0.3.11 and 0.4, and hence the error.
In 0.4.5 I can successfully call the following statements, and get results getStudentByStudentIdList(studentidlist): session.query(Student).filter(Student.c.studentid.in_(studentidlist)).all() But now i will restrict to only 0.4 for my developments Thank you, sbhatt On May 7, 12:53 pm, Michael Bayer <[EMAIL PROTECTED]> wrote: > 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 [email protected] 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 -~----------~----~----~----~------~----~------~--~---
