Hi all,

I'm using Elixir & SQLAlchemy to manage some entities, it's going
quite well. However, I just realize that when I was deleting my
parents entities, my sons entites were not deleted. The're might be
something I didn't get quite well, so that's why I'm requiring some
help...

Let's say I have two classes:

class PublicationElement(Entity):
    using_options(tablename='publication')
    sections = OneToMany('SectionElement')
    covers = OneToMany('PublicationCoverElement')
    publication_id = Field(Integer, primary_key=True)
    name = Field(Unicode(255))
    short_name = Field(Unicode(30))
    app_download_link = Field(UnicodeText)

class SectionElement(Entity):
    using_options(tablename='section')
    publication = ManyToOne('PublicationElement',
colname="publication_id", cascade="all,delete-orphan")
    section_id = Field(Integer, primary_key=True)
    name = Field(Unicode(255))
    articles_on_cover = Field(Integer)
    articles_on_sub_cover = Field(Integer)
    ad_on_top = Field(Boolean)
    ad_on_bottom = Field(Boolean)
    poll_rate_minutes = Field(Integer)
    poll_weight = Field(Integer)
    show_sub_cover = Field(Boolean)

If I delete a PublicationElement entity, all the related
SectionElement entities get their publication_id key set to 0... and I
just can't figure it out why. I've been digging through the web, but
wasn't able any answer... Maybe I putted my cascade argument at the
wrong place ? Not sure to get it...

Thanks in advance,

A.

--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to