t.staid could be the primary key as far as the database is concerned.
The issue is that web2py expects the primary key field to be called
ID.

I'd give Massimo's suggestion of db.define_table(...Field
('staid','id'),...) a shot - he's the man, so he ought to know.

Massimo - what exactly does Field('staid','id') do? Is that just
telling web2py that field staid should be treated as the ID field? Is
'id' now a valid fieldtype just like 'string' or 'integer'?

~Brian

On Dec 10, 6:50 pm, Tim Michelsen <timmichel...@gmx-topmail.de> wrote:
> > You can tell your model the path to the existing sqlite database file
> > with something like
>
> [...]
>
> Thanks a lot for your verbose help! I really appreciate it.
>
> > As for telling it which existing field to use as the ID, as DenesL
> > pointed out if the field isn't already named ID I don't think you can
> > at the moment.
>
> > If you really want to use the station number (t.staid) as your ID, why
> > not just add a new field called ID to your existing table (using
> > sqlite-browser) and then set the value to match t.staid? Something
> > like
>
> I am not a database guru. So I still do not understand why t.staid could
> not be the PK (= ID).
>
> Regards,
> Timmie

--

You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.


Reply via email to