Ok, wasn't know if it was direct Python operator or web2py implementation,
the documentation is not clear about that :
http://web2py.com/books/default/chapter/29/06/the-database-abstraction-layer?search=union

It seems, it is a python operation

Richard


On Tue, Oct 22, 2013 at 3:07 PM, Anthony <[email protected]> wrote:

> Looks like a bug in the "|" operator method -- I think I have a fix.
>
> Anthony
>
>
> On Tuesday, October 22, 2013 1:20:15 PM UTC-4, Richard wrote:
>
>> Ok, actually, it the "|" that lead to the "problem".
>>
>> len(rows1)
>> >>> 1
>> len(rows2)
>> >>> 3
>>
>> rows3 = rows1&rows2
>>
>> len(row3)
>> >>> 4
>>
>> len(rows1)
>> >>> 1
>> len(rows2)
>> >>> 3
>>
>> But
>>
>> rows4 = rows1|rows2
>>
>> len(rows4)
>> >>> 4 (in my use case)
>>
>> len(rows1)
>> >>> 4
>>
>> len(rows2)
>> >>> 3
>>
>> Richard
>>
>>
>>
>>
>> On Tue, Oct 22, 2013 at 1:01 PM, Richard Vézina <[email protected]>wrote:
>>
>>> Hello Anthony,
>>>
>>> Not sure if it is an issue or web2py (or python) is intent to work like
>>> so... But let's say I have 2 rows sets :
>>>
>>> rows1 = query1
>>> rows2 = query2
>>>
>>> rows_combined = rows1 & rows2
>>>
>>> rows_combined and rows1 seems to be equal, I mean rows1 seems to be
>>> containing rows2, so I can't do rows1 & rows3 and not having rows2 since
>>> they are already in rows1 case the preceding rows1 & rows2...
>>>
>>> Thanks
>>>
>>> Richard
>>>
>>>
>>> On Tue, Oct 22, 2013 at 12:21 PM, Richard Vézina 
>>> <[email protected]>wrote:
>>>
>>>> Yes sir!!
>>>>
>>>> I didn't think about it, I don't need to matter with duplicate, since
>>>> each component of the union are mutually exclusive...
>>>>
>>>> At least it was working with or, but very long...
>>>>
>>>> Thanks Anthony!!
>>>>
>>>> Richard
>>>>
>>>>
>>>> On Tue, Oct 22, 2013 at 11:45 AM, Anthony <[email protected]> wrote:
>>>>
>>>>> On Tuesday, October 22, 2013 11:28:07 AM UTC-4, Richard wrote:
>>>>>
>>>>>> Hello,
>>>>>>
>>>>>> I try to do union as explain the book, but it keeps running and
>>>>>> running... on row1|row2, I hava complexe query though with a lot of join
>>>>>> and subrequest...
>>>>>>
>>>>>
>>>>> It loops through row2 and checks whether each record already exists in
>>>>> row1, so if there are a lot of records in either and the records are
>>>>> complex, I suppose that could take a while. If you just do row1&row2
>>>>> instead, that will just combine the two sets of records without removing
>>>>> duplicates -- so if you don't need to worry about duplicates, that should
>>>>> be a lot faster.
>>>>>
>>>>> Anthony
>>>>>
>>>>> --
>>>>> Resources:
>>>>> - http://web2py.com
>>>>> - http://web2py.com/book (Documentation)
>>>>> - http://github.com/web2py/**web2py 
>>>>> <http://github.com/web2py/web2py>(Source code)
>>>>> - 
>>>>> https://code.google.com/p/**web2py/issues/list<https://code.google.com/p/web2py/issues/list>(Report
>>>>>  Issues)
>>>>>
>>>>> ---
>>>>> You received this message because you are subscribed to the Google
>>>>> Groups "web2py-users" group.
>>>>> To unsubscribe from this group and stop receiving emails from it, send
>>>>> an email to web2py+un...@**googlegroups.com.
>>>>>
>>>>> For more options, visit 
>>>>> https://groups.google.com/**groups/opt_out<https://groups.google.com/groups/opt_out>
>>>>> .
>>>>>
>>>>
>>>>
>>>
>>  --
> 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 this message because you are subscribed to the Google Groups
> "web2py-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> For more options, visit https://groups.google.com/groups/opt_out.
>

-- 
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 this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to