[sqlalchemy] Re: Orphans not deleted using cascade parameter

2008-09-04 Thread Michael Brickenstein
and here is the new traceback ;-) Traceback (most recent call last): File foo.py, line 38, in module DBSession.flush() File /Users/michael/programming/rumdemo3/lib/python2.5/site- packages/SQLAlchemy-0.5.0beta3-py2.5.egg/sqlalchemy/orm/scoping.py, line 106, in do return

[sqlalchemy] Re: Orphans not deleted using cascade parameter

2008-09-04 Thread Michael Bayer
On Sep 4, 2008, at 4:15 AM, Michael Brickenstein wrote: AssertionError: Dependency rule tried to blank-out primary key column 'project_programming_language.programming_language_id' on instance '[EMAIL PROTECTED]' the project_programming_language table's primary key is

[sqlalchemy] Re: Orphans not deleted using cascade parameter

2008-09-04 Thread Michael Brickenstein
Dear Michael! Thanks, I got it and understand the difference now. Thank you very much for your help and your time. Michael Am 04.09.2008 um 14:35 schrieb Michael Bayer: On Sep 4, 2008, at 4:15 AM, Michael Brickenstein wrote: AssertionError: Dependency rule tried to blank-out primary key

[sqlalchemy] Re: Orphans not deleted using cascade parameter

2008-09-01 Thread Michael Brickenstein
Hi! Thanks for the answers. I have some problems, reproducing it in a small piece of code. It occurs here. http://toscawidgets.org/trac/rum/ticket/31 I will provide you with details, when I have isolated the problems. Michael On 29 Aug., 17:06, Michael Bayer [EMAIL PROTECTED] wrote:

[sqlalchemy] Re: Orphans not deleted using cascade parameter

2008-08-29 Thread Michael Brickenstein
Hi! Hi have a similar problem using table reflection a la sqlsoup. My DB Backend ist postgresql 8.3. I have a many to many relation: orms5=# \d project_programming_language Table public.project_programming_language Column | Type | Modifiers

[sqlalchemy] Re: Orphans not deleted using cascade parameter

2008-08-29 Thread Michael Brickenstein
I forgot to mention, that I use 0.5.0beta 3. --~--~-~--~~~---~--~~ 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

[sqlalchemy] Re: Orphans not deleted using cascade parameter

2008-08-29 Thread Alex Mathieu
Hi Michael, I had the same problem for a while. I'm not exactly sure what I did in order to fix this (have 2 ideas in my mind, need to figure out which of it it was). As soon as I remember, I'll let you know. On Aug 29, 1:44 am, Michael Brickenstein [EMAIL PROTECTED] wrote: Hi! Hi have a

[sqlalchemy] Re: Orphans not deleted using cascade parameter

2008-08-29 Thread Michael Bayer
Unfortunately, without an illustration of your usage pattern, we can't assist with your issue.Here's the same test case again from earlier in the thread. Can you modify it to look like your failing condition ? rom sqlalchemy import * from sqlalchemy.orm import * from

[sqlalchemy] Re: Orphans not deleted using cascade parameter

2008-08-28 Thread Bob Farrell
On Wed, Aug 27, 2008 at 12:53:38PM -0700, Alex Mathieu wrote: Thanks Michael, I'll have a look over this !! Bob, thanks also for your help, however, I'm not able to use the code... maybe the indention is wrong here or I don't know... I was able to execute the function, but even by putting

[sqlalchemy] Re: Orphans not deleted using cascade parameter

2008-08-27 Thread Alex Mathieu
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 =

[sqlalchemy] Re: Orphans not deleted using cascade parameter

2008-08-27 Thread Alex Mathieu
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

[sqlalchemy] Re: Orphans not deleted using cascade parameter

2008-08-27 Thread Michael Bayer
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

[sqlalchemy] Re: Orphans not deleted using cascade parameter

2008-08-27 Thread Bob Farrell
On Wed, Aug 27, 2008 at 07:48:20AM -0700, 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

[sqlalchemy] Re: Orphans not deleted using cascade parameter

2008-08-27 Thread Alex Mathieu
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

[sqlalchemy] Re: Orphans not deleted using cascade parameter

2008-08-27 Thread Michael Bayer
I'm not fluent with Elixir, but here is a sample script using declarative and SQLite (another database that has a very casual notion of foreign keys) which demonstrates the correct behavior.First convert this script to Elixir (and also to 0.4 if needed, this script is made against

[sqlalchemy] Re: Orphans not deleted using cascade parameter

2008-08-27 Thread Alex Mathieu
Thanks Michael, I'll have a look over this !! Bob, thanks also for your help, however, I'm not able to use the code... maybe the indention is wrong here or I don't know... I was able to execute the function, but even by putting a print as the first line of the function, nothing got printed out,

[sqlalchemy] Re: Orphans not deleted using cascade parameter

2008-08-26 Thread Alex Mathieu
In fact, I think I figured it out how it was working... but I still get this error: class 'sqlalchemy.exceptions.AssertionError': Dependency rule tried to blank-out primary key column 'default_sections.section_id' on instance '[EMAIL PROTECTED]' It appears that it tries to set my foregin key in

[sqlalchemy] Re: Orphans not deleted using cascade parameter

2008-08-26 Thread Michael Bayer
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,

[sqlalchemy] Re: Orphans not deleted using cascade parameter

2008-08-26 Thread Harish K Vishwanath
Try putting the cascade=all, delete, delete-orphan on OneToMany side of the Relationship. On Wed, Aug 27, 2008 at 9:05 AM, 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):