grach wrote: > Hello all, > > I'm relatively new to SQLAlchemy - is there any elegant workaround > that SQLAlchemy provides for queries with in clause that contains more > than 1000 items? > > I have, say, "date, item, value" table that I'd like to query for > arbitrary set of dates and items (date and item list is provided by > the user or generated by the program. (I'd like to avoid creating temp > tables with arguments and perfoming a join).
Since you don't want to use a subquery/temp table, there's no other option except to iteratively execute N number of queries where N is (number of items / 1000), and piece the results together. it can be as easy as: def select_lots_of_stuff(collection): while collection: items, collection = collection[:1000], collection[1000:] for result in conn.execute(<select>.where(col.in_(items))): yield result > > Many thanks, > > -- > You received this message because you are subscribed to the Google Groups > "sqlalchemy" group. > To post to this group, send email to sqlalch...@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. > > -- You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To post to this group, send email to sqlalch...@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.