the autoincrement PK on every table is a default that is not required per 
se to make web2py work, but if you want to use all the features. Generally 
speaking having a single column value that is able to "pinpoint" a 
particular row on the table is a big gain on performances and 
code-readability.

e.g. the grid uses the id to identifying uniquely the record passing it as 
an argument (as in table/edit/1). or, the db.table(1) shortcut won't work 
(it translates roughly to db(db.table.id == 1).select().first())

That being said, you can still use the DAL with db(table.pk1 == 
'value1')(table.pk2 == 'value2')(table.pk3 == 'value3').select() notation.

You can find the relevant details here 
http://web2py.com/books/default/chapter/29/06#Legacy-databases-and-keyed-tables

PS: if you have access to the db, adding an autoincrement field to exploit 
all the web2py's internals is generally worth the addition of the column.

-- 



Reply via email to