I thought I had read somewhere that it was possible to have a model for
a legacy table without a primary key as long as the useage was read only
and that the method was "filter" and not "get".  I've been searching for
quite a while now and all I can find indicates a primary key is
mandatory for any model.  I'm using Django 1.3 with MySQL 5.0 but plan
to upgrade to MySQL 5.5 if that makes any difference.

 

The table has 4 fields that are unique together: userid, application,
role, facility.  I populate the latter 3 by decoding the ldap group.
Unfortunately ldap group names are not defined consistently, so I have
to write a special parser for each application (that I support in
Django).  This table will be refreshed using MySQLdb from a cron job
that queries ldap (i.e. no Django at this phase).  This  process updates
a generic access table that is used by all my django apps.

 

I control this table, so I could let Django create an autonumber id as
primary key, or I could combine all 4 columns to create a  primary key.
Since I really don't need or have a good use for a primary key in this
table, either technique seems inappropriate.  However if I'm being anal
about this whole pk issue and need to just  bite the bullet, so be it.

 

Any sage advice?

 

Fred.

-- 
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+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to