jose wrote:

>Jonathan Ellis wrote:
>
>  
>
>>On 2/16/07, jose <[EMAIL PROTECTED]> wrote:
>> 
>>
>>    
>>
>>>Jonathan Ellis wrote:
>>>   
>>>
>>>      
>>>
>> 
>>
>>    
>>
>>>>Guess it would surprise you to learn about the SQL 92 "ON DELETE SET
>>>>NULL" functionality too. :)
>>>>
>>>>
>>>>     
>>>>
>>>>        
>>>>
>>>Seems to me the SQL92 'ON DELETE SET NULL' is an explicit functionality,
>>>instead in our case, SA does this functionality in implicit way. :-(
>>>I hope there's a sort of configuration to disable this functionality.
>>>   
>>>
>>>      
>>>
>>Sure, set a NOT NULL constraint on the column you don't want to be
>>null.  Which you should really be doing anyway. :)
>> 
>>
>>    
>>
>No Jonathan, I don't want this column is set as NOT NULL, I have to 
>allow null values for this column and I don't want enable the "ON DELETE 
>SET NULL" functionality.
>I would like SA have the same behavior as PostgreSQL has, I like the 
>message:
>
>pg> delete from specie where codice='89';
>ERROR:  update or delete on "specie" violates foreign key constraint 
>"attivita_cod_specie_fkey" on "attivita"
>DETAIL:  Key (codice)=(89) is still referenced from table "attivita".
>
>Is there another way to do that?
>
>jo
>
>  
>
I think I found the way to avoid ON DELETE SET NULL... if I delete the 
backref for 'specie' it works. :-)

assign_mapper(context, Attivita, tbl['attivita'], properties = dict(
         tipologia_struttura     = relation(TipologiaStruttura, 
backref='attivita'),
         organizzazione          = relation(Organizzazione, 
backref='attivita'),
         prodotto                = relation(Prodotto, backref='attivita'),
         orientamento_produttivo = relation(OrientamentoProduttivo, 
backref='attivita'),
         specie                  = relation(Specie, backref='attivita'),
         attivita_istat          = relation(AttivitaIstat, 
backref='attivita'),
         ))




--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to