Friday, December 30, 2011

Re: model for legacy table without primary key

You said the four fields are unique together, but "userid" sounds like
it should also be unique be itself, in which case it could be your PK.

In either case, you are being a bit an4l about something that matters
little. You should probably just create another column for an auto-
incrementing PK.

K.C.

On Dec 30, 1:05 pm, akaariai <akaar...@gmail.com> wrote:
> On Dec 30, 7:53 pm, Bill Beal <b.b...@eximflow.com> wrote:
>
> > But it can't be a primary key if the values are not unique, right?
> > The four fields are unique together, but not necessarily individually.
>
> It is not a real primary key. The idea is to tell Django it is a
> primary key even if it is not. And hope everything works OK (should
> work for most SELECT queries).
>
> So, it is just an ugly hack. Do not try this with writing queries,
> data corruption is guaranteed :)
>
> - Anssi

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

No comments:

Post a Comment