Re: [web2py] Re: avoid separate query within second nested loop

2015-06-14 Thread Niphlod
sorry what ? On Friday, June 12, 2015 at 11:35:49 PM UTC+2, Alex Glaros wrote: are there file size limitations when moving to dict that are not an issue if python loop? -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py

Re: [web2py] Re: avoid separate query within second nested loop

2015-06-14 Thread Alex Glaros
is there a size limitation to a dictionary? (want to know in general for future purposes) is there consequential extra overhead if using the dictionary method? thanks Alex -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source

Re: [web2py] Re: avoid separate query within second nested loop

2015-06-14 Thread Niphlod
On Sunday, June 14, 2015 at 11:56:34 PM UTC+2, Alex Glaros wrote: is there a size limitation to a dictionary? (want to know in general for future purposes) generally, your OS free memory. is there consequential extra overhead if using the dictionary method? of course, its an

Re: [web2py] Re: avoid separate query within second nested loop

2015-06-12 Thread Niphlod
it's just a matter of ordering by the parent and then the child. Once you get a resultset similar to parent.id | parent.style | child.id | child.name 1 yellow 4 foo1 1 yellow 5 bar1 1 yellow 6 baz1 2

Re: [web2py] Re: avoid separate query within second nested loop

2015-06-12 Thread Alex Glaros
are there file size limitations when moving to dict that are not an issue if python loop? -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received

Re: [web2py] Re: avoid separate query within second nested loop

2015-06-12 Thread Alex Glaros
I get the ordering but parent appears redundantly. Do I iterate through loop checking for change in parent.id so parent only gets displayed first time? if parent.id != previous_parent_id display this specific parent.id one time only previous_parent_id = parent.id ## am resetting the

Re: [web2py] Re: avoid separate query within second nested loop

2015-06-12 Thread Dave S
On Friday, June 12, 2015 at 2:12:51 PM UTC-7, Alex Glaros wrote: I get the ordering but parent appears redundantly. Do I iterate through loop checking for change in parent.id so parent only gets displayed first time? if parent.id != previous_parent_id display this specific

[web2py] Re: avoid separate query within second nested loop

2015-06-12 Thread Niphlod
is it better to issue two separate queries returning a set with 2 records and 10 respectively or to fetch a joined set (and massage it later on) that extracts 20 records ? There's no answer to that except that the two possibilities are entirely doable. Cardinality of the sets comes into play,

Re: [web2py] Re: avoid separate query within second nested loop

2015-06-12 Thread Alex Glaros
did you mean I only need the second query? I know it already extracts data that query one has, but I didn't know how to iterate using only the second one and not redundantly display the parent values. On Fri, Jun 12, 2015 at 12:06 PM, Niphlod niph...@gmail.com wrote: is it better to issue two

Re: [web2py] Re: avoid separate query within second nested loop

2015-06-12 Thread Niphlod
so you have a problem with python, not the database! if you're not loop-proficient, massage it first to a dictionary, then loop over it from collections import defaultdict resultset = defaultdict(list) for row in parents_and_childs: resultset[row.parent_record.id].append(row) then you can