Thanks for the info. Would you please comment on my following understanding and further questions?
1. Keyed tables are only designed for dealing with legacy tables. Is that true? And how do we define multiple primary keys in a brand new db? Consider the address book scenario in my previous post. 2. Keyed tables are yet to be supported in some other DB engines, but NOT the handy SQLite. Is there any special reason for that? AFAIK SQLite contains native support for multiple primary key. 3. Neither keyword KeyedTable nor primarykey can be found in http://www.web2py.com/book right now. Why? Denes' good work deserves being mentioned as a dedicated section. Thanks in advance. Sincerely, Iceberg On May9, 8:55pm, DenesL <denes1...@yahoo.ca> wrote: > SQLite is not one of the supported DBs. > Keyed tables are only supported in MS SQL, DB2, Ingres and Informix. > Other DB engines (except SQLite)might be added following section E > inhttp://groups.google.com/group/web2py/msg/c9848792a8999c5f > > On May 8, 2:48 pm, Iceberg <iceb...@21cn.com> wrote: > > > > > I am not dealing with legacy tables, I am just starting a new db and > > wondering whether I can set multiple primary key, in order to > > eliminate the chance of duplicated data. > > > For example. > > > db = DAL('sqlite://storage.sqlite') > > db.define_table('account', > > Field('given_name'), > > Field('surname'), > > Field('phone_number'), > > primarykey=['given_name','surname']) > > > On May9, 3:23am, DenesL <denes1...@yahoo.ca> wrote: > > > > Multiple primary keys should work if you are defining legacy tables in > > > one of the supported DB engines. > > > Are you using MS SQL, DB2, Ingres or Informix? > > > Can we see the model? > > > > On May 8, 5:57 am, Iceberg <iceb...@21cn.com> wrote: > > > > > Hi there, > > > > > I am fiddling multiple primary keys. Somehow I managed to find > > > > following example inside gluon/sql.py > > > > > db.define_table('account', > > > > Field('accnum','integer'), > > > > Field('acctype'), > > > > Field('accdesc'), > > > > primarykey=['accnum','acctype']) > > > > > But running the example throws: > > > > > Traceback (most recent call last): > > > > ...... > > > > File "C:\DOWNLOAD\google_appengine\web2py\gluon\sql.py", line 2112, > > > > in __init__ > > > > raise SyntaxError, 'invalid table "%s" attribute: %s' % > > > > (tablename, k) > > > > SyntaxError: invalid table "account" attribute: sequence_name > > > > > What did I do wrong? > > > > > Iceberg