Hi,

> Hi, This is causing very messy code though, especially if youa re
> deleteing an article.
> Here is now i have it now. The flush is needed,  
> or else i get an AssertionError saying SA is trying to flush 0 into a
> primary_key.

Could you give more details ? I tried using the previous attached code, seems 
to work nice:

c = Article.get(###)
c.delete()
c.flush()       # delete article and its article_related

You can find this code in attachment.

You may also want to play with backrefs if you just want to have a reference 
to the "relater" in the "related" article ("A relates to B", B would have 
reference to A without saying "B relates to A")


Hope that helps

Cheers,

Seb
-- 
Sébastien LELONG
http://www.sirloon.net
sebastien.lelong[at]sirloon.net

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To post to this group, send email to sqlalchemy@googlegroups.com
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
-~----------~----~----~----~------~----~------~--~---

Attachment: articles.py
Description: application/python

Reply via email to