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 <[email protected]> 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 <[email protected]> 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