F*ck... I just realized that I was using  MyISAM table engine...
here's the deal then... I cannot use InnoDB for this projet so.... I
think I will be writing some recursive code that can determine if an
object has childs dependencies and will delete the proper objects....

thanks again =)

On Aug 27, 9:26 am, Alex Mathieu <[EMAIL PROTECTED]> wrote:
> Hi Michael,
>
> I've switch my definition to the following:
>
> 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')
>     feedDetails = OneToOne('FeedDetailsElement',
> inverse='SectionElement')
>     defaultSections = OneToOne('DefaultSectionElement',
> inverse='SectionElement')
>     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)
>
> However, nothing seems to change, the rows into my sections table of
> my database get their publication_id key set to 0, yet again no entry
> gets removed from the database...
>
> Harish > Thanks for the hint, but however, no success with this
> solution... :(
>
> What would be the next step in order to figure out what is happening ?
> Just to confirm, my Publication element is safely removed from the
> database, every time.
>
> Thanks again, in advance
>
> On Aug 26, 11:35 pm, Michael Bayer <[EMAIL PROTECTED]> wrote:
>
> > On Aug 26, 2008, at 6:08 PM, Alex Mathieu wrote:
>
> > > 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...
>
> > this mapping suggests that the deletion of a SectionElement will cause  
> > the deletion of a related PublicationElement, but not the other way  
> > around.   The cascade would have to be moved to the  
> > "PublicationElement.sections" side of the relation.    Im not sure  
> > where the "0" is coming from, SQLAlchemy will normally set foreign key  
> > references to NULL if no row is related.
--~--~---------~--~----~------------~-------~--~----~
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