I thought this would work with custom SQL Using latest version of web2py in gae interactive console I have for testing purposes:
from gluon.contrib.gql import gae from gluon.dal import * db = DAL('gae') db.define_table('Contact', Field('name', 'string')) db.define_table('PhoneNumber', Field('contact', gae.ReferenceProperty()), Field('phone_type', 'string'), Field('number', 'string')) db.Contact.insert(name='Scotty') from google.appengine.api.datastore_types import Key rows = db(db.Contact.name=='Scotty').select() selected_row = rows[0] key = Key.from_path("Contact",selected_row.id) db.PhoneNumber.insert(contact=key, phone_type='home', number='(650) 555 - 2200') db.PhoneNumber.insert(contact=key, phone_type='mobile', number='(650) 555 - 2201') entity_keyselect = db(db.PhoneNumber.contact == key).select() print 'Content-Type: text/html' print for c in entity_keyselect: print '%s: %s' % (c.phone_type, c.number) I get returned error: Traceback (most recent call last): File "C:\Python25\google\appengine\ext\admin\__init__.py", line 247, in post exec(compiled_code, globals()) File "<string>", line 21, in <module> File "C:\Python25\content\gluon\dal.py", line 5031, in insert return self._db._adapter.insert(self,self._listify(fields)) File "C:\Python25\content\gluon\dal.py", line 3436, in insert dfields=dict((f.name,self.represent(v,f.type)) for f,v in fields) File "C:\Python25\content\gluon\dal.py", line 3436, in <genexpr> dfields=dict((f.name,self.represent(v,f.type)) for f,v in fields) File "C:\Python25\content\gluon\dal.py", line 2990, in represent if fieldtype.startswith('list:'): AttributeError: 'ReferenceProperty' object has no attribute 'startswith' Any help Aprreciated Chris