Re:Boltons: A set of BSD-licensed, pure-Python utilities
by pmoriarty on Tuesday October 09, 2018 @07:39PM
(#18180741)
Could you give some examples?
[ Parent
| on HN ]
Re:Boltons: A set of BSD-licensed, pure-Python utilities
by btgeekboy on Tuesday October 09, 2018 @08:41PM
(#18181024)
I wrote some similar code one time that generated SQL which was manually reviewed. It generated a massive WHERE IN clause. Oracle only accepts 1000 values. So I fed it a list of thousands of values, and it chunked them into rows of N objects, and into larger chunks of 1000. Having some code to do that automatically would be quite nice.
Re:Boltons: A set of BSD-licensed, pure-Python utilities
by Bootvis on Wednesday October 10, 2018 @04:45AM
(#18183098)
Why not insert the values in WHERE IN to a temporary helper table and join on that? It seems somewhat easier and might perform better.
Re:Boltons: A set of BSD-licensed, pure-Python utilities
by orf on Wednesday October 10, 2018 @05:17AM
(#18183245)
Oracle has a limit on the number of parameters in a query, not just in the `WHERE IN` clause. So you'd need to insert them into the helper table in batches of 1000.
Re:Boltons: A set of BSD-licensed, pure-Python utilities
by Bootvis on Wednesday October 10, 2018 @07:25AM
(#18183793)
Good point, but isn’t that done automatically by whatever tool your using?
And if the table your selecting from is big enough I would expect that this setup would be faster but it’s hard to say. It would also more easily guarantee that your results will be consistent.
Re:Boltons: A set of BSD-licensed, pure-Python utilities
by gugagore on Tuesday October 09, 2018 @08:43PM
(#18181042)
Two that I run into all the time:
1. pairwise iteration over a (cylic) list of points representing the ordered vertices of a polygon will give you a sequence of edges
2. np.diff, takes differences between consecutive pairs. Sometimes you have a different kind of "difference" operation, though. The pairwise iteration helps you express that.