Re: [web2py] Re: Combining rows

2013-10-23 Thread Richard Vézina
Great!

Thanks Anthony

Richard


On Tue, Oct 22, 2013 at 9:24 PM, Anthony abasta...@gmail.com wrote:

 On Tuesday, October 22, 2013 3:48:26 PM UTC-4, Richard wrote:

 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=unionhttp://web2py.com/books/default/chapter/29/06/the-database-abstraction-layer?search=union


 The Rows class defines its own methods for the  and | operators (via the
 __and__ and __or__ special methods). I just submitted a patch to fix the
 problem with the | operator (it returns a new Rows object, but it was also
 inadvertently mutating the existing Rows object).

 Anthony

 --
 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 web2py+unsubscr...@googlegroups.com.
 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 web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [web2py] Re: Combining rows

2013-10-22 Thread Richard Vézina
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...

When was this feature was available, I have web2py 2.4.7

Thanks

Richard


On Tue, Jun 11, 2013 at 7:13 AM, webpypy ad...@aqar-riyadh.com wrote:


 yes, I am sure it is working without as_dict().


 Regards,

 Ashraf

  --

 ---
 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+unsubscr...@googlegroups.com.
 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 web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [web2py] Re: Combining rows

2013-10-22 Thread Anthony
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 row1row2 
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 (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 web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [web2py] Re: Combining rows

2013-10-22 Thread Richard Vézina
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 abasta...@gmail.com 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 row1row2
 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 (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 web2py+unsubscr...@googlegroups.com.
 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 web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [web2py] Re: Combining rows

2013-10-22 Thread Richard Vézina
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 
ml.richard.vez...@gmail.com 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 abasta...@gmail.com 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 row1row2
 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 (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 web2py+unsubscr...@googlegroups.com.
 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 web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [web2py] Re: Combining rows

2013-10-22 Thread Richard Vézina
Ok, actually, it the | that lead to the problem.

len(rows1)
 1
len(rows2)
 3

rows3 = rows1rows2

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 ml.richard.vez...@gmail.com
 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 
 ml.richard.vez...@gmail.com 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 abasta...@gmail.com 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 row1row2
 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 (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 web2py+unsubscr...@googlegroups.com.
 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 web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [web2py] Re: Combining rows

2013-10-22 Thread Anthony
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 = rows1rows2

 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 
 ml.richa...@gmail.comjavascript:
  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 
 ml.richa...@gmail.comjavascript:
  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 abas...@gmail.comjavascript:
  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 row1row2 
 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 (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 web2py+un...@googlegroups.com javascript:.
 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 web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [web2py] Re: Combining rows

2013-10-22 Thread Richard Vézina
Consider I have w2p 2.4.7

Richard


On Tue, Oct 22, 2013 at 3:48 PM, Richard Vézina ml.richard.vez...@gmail.com
 wrote:

 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 abasta...@gmail.com 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 = rows1rows2

 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 
 ml.richa...@gmail.comwrote:

 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 ml.richa...@gmail.com
  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 abas...@gmail.com 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 row1row2
 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/listhttps://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_outhttps://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 web2py+unsubscr...@googlegroups.com.
 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 web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [web2py] Re: Combining rows

2013-10-22 Thread Richard Vézina
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 abasta...@gmail.com 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 = rows1rows2

 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 ml.richa...@gmail.comwrote:

 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 
 ml.richa...@gmail.comwrote:

 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 abas...@gmail.com 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 row1row2
 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/listhttps://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_outhttps://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 web2py+unsubscr...@googlegroups.com.
 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 web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [web2py] Re: Combining rows

2013-10-22 Thread Anthony
On Tuesday, October 22, 2013 3:48:26 PM UTC-4, Richard wrote:

 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


The Rows class defines its own methods for the  and | operators (via the 
__and__ and __or__ special methods). I just submitted a patch to fix the 
problem with the | operator (it returns a new Rows object, but it was also 
inadvertently mutating the existing Rows object).

Anthony

-- 
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 web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Re: Combining rows

2013-06-11 Thread webpypy

yes, I am sure it is working without as_dict().


Regards,

 Ashraf



-- 

--- 
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+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[web2py] Re: Combining rows

2013-06-10 Thread Massimo Di Pierro
   locs=[row for row in dept_locs if row.id in todept_locs.as_dict()]

The . was missing.

On Monday, 10 June 2013 00:21:43 UTC-5, webpypy wrote:


 locs=[row for row in dept_locs if row.id in todept_locs as_dict()]

 is invalid syntax.

 what is the problem?



-- 

--- 
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+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[web2py] Re: Combining rows

2013-06-10 Thread webpypy
Thank you, Massimo.

the following works fine.

locs=[row for row in dept_locs if row in todept_locs]

is  as_dict()  not mandatory all the time?

Please, explain.

Regards,

Ashraf

-- 

--- 
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+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[web2py] Re: Combining rows

2013-06-10 Thread Massimo Di Pierro
It should not work without .as_dict(). Are you sure it does?

On Monday, 10 June 2013 10:53:07 UTC-5, webpypy wrote:

 Thank you, Massimo.

 the following works fine.

 locs=[row for row in dept_locs if row in todept_locs]

 is  as_dict()  not mandatory all the time?

 Please, explain.

 Regards,

 Ashraf


-- 

--- 
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+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[web2py] Re: Combining rows

2013-06-09 Thread Massimo Di Pierro
You can do this:

rows = [row for row in row1 if not row.id in row2.as_dict()]


On Sunday, 9 June 2013 18:15:03 UTC-5, webpypy wrote:

 Hi,

 How an I do intersection?

 The manual says:


 Row objects can be combined at the Python level. Here we assume:

  print rows1person.name
 Max
 Tim
  print rows2person.name
 John
 Tim

 You can do a union of the records in two set of rows:

  rows3 = rows1  rows2
  print rows3
 name
 Max
 Tim
 John
 Tim

 You can do a union of the records removing duplicates:

  rows3 = rows1 | rows2
  print rows3
 name
 Max
 Tim
 John



 Regards,

 Ashraf


-- 

--- 
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+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[web2py] Re: Combining rows

2013-06-09 Thread webpypy
Hi Massimo,

I think there is no 'not'.

am I right?

Regards,

Ashraf

-- 

--- 
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+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[web2py] Re: Combining rows

2013-06-09 Thread webpypy

locs=[row for row in dept_locs if row.id in todept_locs as_dict()]

is invalid syntax.

what is the problem?

-- 

--- 
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+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.