> >>> row2=db((db.entry.acc_id==db.acc.id) and (db.entry.txn_id==1)).select > ().first() >
In a DAL query, you must use & rather than and. By using the latter, you are getting the standard Python behavior, whereby x and y simply yeilds y. So, in this case, your query is equivalent to simply doing db(db.entry.txn_id == 1), which does not result in a join and therefore excludes the table name when accessing field values in a Row. Also is there some way to force DAL simply return rows containing just > values, maybe in the form of list of lists? > You could use db(query).select().as_list(), which gives you a list of dictionaries, but that would be less efficient, as it will first create the Rows object and then convert it. An alternative is to forego the creation of the Rows object and instead take the list of tuples returned by the database driver. Two ways to do this are: records = db.executesql(db(query)._select()) The ._select() method is the same as .select(), except it returns the raw SQL rather than executing the select. You can then pass that SQL to .executesql(), which will ultimately return whatever the database driver returns. You can achieve the same effect by passing a custom processor function to .select(), which it will use to generate whatever output you want based on the results from the database driver: records = db(query).select(processor=lambda records, **kwargs: records) The first argument .select() will pass to the processor callback is the list of records returned by the database driver, so the above lambda simply returns that first argument with no further processing. 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/d/optout.