Re: Legacy database with a table, which has no separate primary key

2010-10-15 Thread Alexander
Thank you for such a comprehensive answer. I chose to add the field to the table. It seems to be the best solution. -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscri

Re: Legacy database with a table, which has no separate primary key

2010-10-15 Thread David De La Harpe Golden
On 15/10/10 12:15, Alexander wrote: > As you can see the 'rating' table has no separate primary key field. Yeah, that is pretty commonplace (though not presently supported by django), the natural primary key for a table may be composite... > Here are the models created by Django with some my cor

Re: Legacy database with a table, which has no separate primary key

2010-10-15 Thread Alexander
Thanks for your reply. -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options

Re: Legacy database with a table, which has no separate primary key

2010-10-15 Thread Devin M
Wait... I just looked at your sql and it looks like you would need to use multiple-column primary keys which are unsupported by django. http://code.djangoproject.com/ticket/373 On Oct 15, 4:15 am, Alexander wrote: > I have a database, which among others has the following tables: > > CREATE TABLE

Re: Legacy database with a table, which has no separate primary key

2010-10-15 Thread Devin M
I did some quck googling and found this. http://stackoverflow.com/questions/605896/django-querying-read-only-view-with-no-primary-key This is the response from them that seems most helpful. "all you need is a column that is guaranteed to be unique for every row. Set that to be 'primary_key = True

Legacy database with a table, which has no separate primary key

2010-10-15 Thread Alexander
I have a database, which among others has the following tables: CREATE TABLE users ( userId BIGINT PRIMARY KEY ); CREATE TABLE movies ( movieId BIGINT PRIMARY KEY, title varchar(255) NOT NULL ); CREATE TABLE ratings ( userId BIGINT NOT NULL REFERENCES users(userId), movieId BIGINT NOT