I'm trying to use GAE with web2py and I'm having a few small teething
problems.
If I do the following:
db.define_table('company',
db.Field('name', 'string'))
db.define_table('shop',
db.Field('company', db.company),
db.Field('address', 'string'))
company = db.company.insert(name = 'Super Books') # assume it gets an
Id of 1.
db.shop.insert(company = company, address = '10 Main Street')
db.shop.insert(company = company, address = '20 Back Street')
company = db.company[1];
print company
gives:
id : 1
name : Super Books
shop : <gluon.sql.Set object at 0x1e06410>
So according to the docs
http://web2py.com/book/default/section/6/6
I should be able to do the following:
for company in db().select(db.company.ALL):
print company.name
for shop in company.shop.select():
print ' ---> ', shop.address
Which when I execute gives the following error:
Traceback (most recent call last):
File "/Apps/web2py/gluon/restricted.py", line 173, in restricted
exec ccode in environment
File "/Apps/web2py/applications/init/controllers/
default.py:testing", line 290, in <module>
File "/Apps/web2py/gluon/globals.py", line 96, in <lambda>
self._caller = lambda f: f()
File "/Apps/web2py/applications/init/controllers/
default.py:testing", line 124, in testing
File "/Apps/web2py/gluon/sql.py", line 3055, in select
query = self._select(*fields, **attributes)
File "/Apps/web2py/gluon/sql.py", line 2947, in _select
raise SyntaxError, 'Set: no tables selected'
SyntaxError: Set: no tables selected
Whereas:
rows = db(db.shop.id>0).select()
for row in rows:
print row.company.name, row.address
Works fine.
Is this the expected behavior given that I'm using GAE or have I done
something completely wrong?
Thanks in advance,
Matt
--
You received this message because you are subscribed to the Google Groups
"web2py-users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/web2py?hl=en.