SQL question
Antoine Nguyen
tonio at ngyn.org
Thu Jul 28 17:15:59 CEST 2011
On 28/07/2011 17:04, Mark Martinec wrote:
> Antoine,
>
>> for my quarantine managment application, I'm trying to use Django's
>> internal ORM to access Amavis database. Almost everything works fine,
>> except for the 'msgrcpt' table.
>>
>> Django complains about the fact this table does not present a direct
>> primary key (I guess it is a composite key between the 'mail_id' and
>> 'rid' fields?). It is a shame but currently, django does not support :
>> * tables (models) without primary key,
>> * composite primary keys.
>>
>> As I'm not going to wait for a potential django's update about this
>> feature, I'm trying to look for another solution and here is my question:
>>
>> Would it be problematic if I add a new field to the 'msgrcpt' table,
>> like an auto incremented integer field that will act as a primary key
>> only for django ?
> Should be alright I believe.
>
> Mark
Thanks Mark. This is what I thought but I wanted an "official"
confirmation. It seems that the 'wblist' table is in the case?
By the way, I didn't notice the 'quarantine' table was using an explicit
composite primary key (between 'mail_id' and 'chunk_ind'). I really
don't know how to make it work with django's orm... It smells like I'm
going to rollback this work and finally wait for django to support
composite keys.
Anybody here who has already try to achieve such a thing? :-)
--
Antoine Nguyen
Modoboa developer
http://modoboa.org
More information about the amavis-users
mailing list