you have the three columns in request_table marked as foriegn keys.
therefore, when a row from stock_request is removed, there is no
choice but to set to NULL the three columns youve named in
request_table. so if thats what you mean by "delete", thats whats
happening. if you remove a stock item, nothing will happen assuming
the mapping below is all there is. It cant be actually issuing a
DELETE since you dont have delete cascade turned on.
On Mar 25, 2007, at 6:21 AM, Koen Bok wrote:
>
> I have a mapper like this:
>
> mapper(Request, request_table, properties={
> [SOME MORE STUFF]
> 'stock': relation(Stock, lazy=True, uselist=False,
> primaryjoin=and_(
> request_table.c.id_item==stock_request.c.id_product,
>
> request_table.c.id_location==stock_request.c.id_location,
>
> request_table.c.id_stocktype==stock_request.c.id_stocktype),
> foreign_keys=[request_table.c.id_item,
> request_table.c.id_location,
> request_table.c.id_stocktype])})
>
> Whenever I remove a request object that has a stock object associated,
> it deletes the stock object too. When I change the foreign_keys to
> stock_request.c.id_product, stock_request.c.id_location,
> stock_request.c.id_stocktype it tries to update the related object
> with NULL values.
>
> But I want it to not do anyithing at all! I played with the cascade
> rules, but they all either delete or update.
>
> Thanks!
>
> Koen
>
>
> >
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---