Damn, so why does the cascade statement does not work ? I simply can't
get that one... I've been trying all the examples using the cascade
argument in the relationships declaration, like you said in your first
post, and it won't just work.
I just gave it another try, and my Publication element get deleted,
but my sections elements get their publication_id keys set to 0, and
not being deleted... Here's my entities:
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, delete-orphan")
feedDetails = OneToOne('FeedDetailsElement', inverse='section')
defaultSections = OneToOne('DefaultSectionElement',
inverse='section')
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)
Well well....
On Aug 27, 10:53 am, Michael Bayer <[EMAIL PROTECTED]> wrote:
> On Aug 27, 2008, at 10:48 AM, Alex Mathieu wrote:
>
>
>
> > 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 =)
>
> SQLA's "cascade" option works with MyISAM tables just fine - it does
> not require real foreign keys or cascades at the database level to be
> present. The only thing you'd lose in that case is the ability to
> reflect ForeignKey objects from an existing schema, but your mapping
> below should be creating those explicitly. Theres definitely no
> reason to write this by hand.
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---