--
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+...@googlegroups.com.
To post to this group, send email to sqlal...@googlegroups.com.
Visit this group at http://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.
you batch out the values to be used in the IN, then one of two choices: my preference is to run separate SELECT statements, using IN with each batch. If you really can’t do that, you can combine the batches of IN groups with an OR: “x IN (batch1) OR x IN (batch2) …”
keep in mind when you send enormous strings to your database, that places a burden on the query system. Oracle (which I assume you’re using) also caches these queries
Hi Michael and thanks a lot.
Il giorno venerdì 5 settembre 2014 18:23:31 UTC+2, Michael Bayer ha scritto:you batch out the values to be used in the IN, then one of two choices: my preference is to run separate SELECT statements, using IN with each batch. If you really can’t do that, you can combine the batches of IN groups with an OR: “x IN (batch1) OR x IN (batch2) …”O spent 2 day to find a solutions:I make write to python this string:cmd_str = "session.query(MAPPCLASS).filter(or_(MAPPCLASS.id_invmat.in_([1, 2, 3, 4])).(MAPPCLASS.id_invmat.in_([5, 6, 7, 8]))).order_by(asc(MAPPCLASS.id_invmat)).all()"But I receive this error..Neither 'BinaryExpression' object nor 'Comparator' object has an attribute ‘or_'
i once thought about extending SqlAlchemy to handle this issue behind the scenes, but each database treats `IN()` differently. for example: oracle maxes out at a number of elements, while mysql maxes out based on the size of the overall statement (which is configured on the server). it's too much work to limit this in sqlalchemy, as these limits change across servers. [ i forget what postgres maxed out on, i think it was a hard number too.]
the workaround I used was to just build a query-base, and then run multiple selects with a single `IN` within a for-loop which appends to a list. i found that performance to be much better than chaining multiple `IN()` with `OR`
On 13 Sep 2014, at 11:25, pyArchInit ArcheoImagineers <pyarc...@gmail.com> wrote:Il giorno giovedì 11 settembre 2014 18:39:24 UTC+2, Jonathan Vanasco ha scritto:i once thought about extending SqlAlchemy to handle this issue behind the scenes, but each database treats `IN()` differently. for example: oracle maxes out at a number of elements, while mysql maxes out based on the size of the overall statement (which is configured on the server). it's too much work to limit this in sqlalchemy, as these limits change across servers. [ i forget what postgres maxed out on, i think it was a hard number too.]
the workaround I used was to just build a query-base, and then run multiple selects with a single `IN` within a for-loop which appends to a list. i found that performance to be much better than chaining multiple `IN()` with `OR`My problem is to find a dataset of more than 999 records and sort all through ORDER BY statement. How can I use multiple selects and order all records?