I have dozens of tables in an existing MSSQL database all with autonumber ID primary keys, but none that are named 'id'. They are instead named PropertyID, ClientID, etc. The official documentation seems to suggest renaming each of these fields to 'id':
Legacy Databases
web2py can connect to legacy databases under some conditions:
- Each table must have a unique auto-increment integer field called "id"
- Records must be referenced exclusively using the "id" field.
If these conditions are not met, it is necessary to manually ALTER TABLE to conform them to these requirements, or they cannot be accessed by web2py.
This should not be thought of as a limitation, but rather, as one of the many ways web2py encourages you to follow good practices.
However, that would require breaking hundreds of existing queries in other applications that use this database. Surely there must be some way to specify a name for an existing autonumber field to be used instead of 'id'.
This seems to be an area where Django got it right and web2py got it horribly wrong. Or am I just missing something? Seems I was just missing something...