This is failing example:
db=DAL('sqlite:memory')
db.define_table('tt',
Field('vv', 'integer'),
Field.Virtual('x', lambda row: row.tt.vv * 10))
db.define_table('tt2',
Field('ttref', 'reference tt'),
Field('vv2', 'integer'))
tt1 = db.tt.insert(vv='1')
tt2 = db.tt.insert(vv='3')
db.tt2.insert(ttref=tt1, vv2='3')
db.tt2.insert(ttref=tt2, vv2='4')
records = db(db.tt).select(
db.tt.ALL, db.tt2.ALL,
join=[db.tt2.on(db.tt2.ttref == db.tt.id)]
)
for r in records:
print r
Result:
<Row {'tt2': {'ttref': 1L, 'id': 1L, 'vv2': 3L}, 'tt': {'id': 1L, 'vv':
1L}}>
<Row {'tt2': {'ttref': 2L, 'id': 2L, 'vv2': 4L}, 'tt': {'id': 2L, 'vv':
3L}}>
As you can see virtual field 'x' (in table 'tt') is missing. As I
understand this occurs when selecting records from more than one table. In
my case (with PostgreSQL) every time I use db(...).select(db.table.ALL,
TOTAL_ROWS, ...) where TOTAL_ROWS = 'COUNT(*) OVER()'.
--
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/d/optout.