views:

33

answers:

1

I have this model in web2py DAL:

db.define_table('category',
     Field('name','string'),
     format='%(name)s'
)

db.define_table('uploaded_question',
    Field('text','string'),
    ...
    Field('category', 'string')    
)

This:

db.category(db.category.name == uploaded_question.category) always

returns none in GAE sandbox (it works fine in SQLlite).

How should I adapt this sentence to work in GAE?

+2  A: 

I cannot tell from the partial code but it seems you are doing two things: 1) you are denormalizing (db.uploaded_question.category is a string and not a reference) 2) you are doing an inner JOIN (even if category is not a reference). Your syntax is incorrect should be

   rows = db(db.category.name == db.uploaded_question.category).select()

The problem is that that you cannot do JOINs on GAE. They do not support joins.

Anyway, it not clear why you do a join if you have denormalized, so perhaps I misunderstood.

We will be happy to help you more on the web2py mailing list.

mdipierro
Perfect! Thanks a lot! I am in web2py now