[sqlalchemy] Re: Cascade Deletes

2011-08-09 Thread Stefano Fontanelli
Il 09/08/11 02.42, Aviv Giladi ha scritto: Dear Stefano, First of all, thank you. Allow me to express how much I appreciate your time and assistance - you and your colleagues are making the technology world this much better by being so attentive and helpful! Thank you. Therefore I chose t

[sqlalchemy] Re: Cascade Deletes

2011-08-08 Thread Stefano Fontanelli
Il 08/08/11 22.53, Aviv Giladi ha scritto: Dear Stefano, I have been able to create a reproducing project. I am sending it to you directly because I was unable to figure out how to attach the test file to the message board. I will post our findings there once we are done. The included scrip

[sqlalchemy] Re: Cascade Deletes

2011-08-08 Thread Aviv Giladi
Stefano, Thank you again for your time. I am sorry for not posting my actual code - it is sensitive, therefore I am trying to reproduce the same issue with different code. In my __init__ function of my Rating I am setting 3 members that are objects like so: self.member = member These members

Re: [sqlalchemy] Re: Cascade Deletes

2011-08-07 Thread Stefano Fontanelli
Il 07/08/11 20.08, Aviv Giladi ha scritto: I see. Where can I start looking for such an error? What could possibly be causing this? I'm sorry but I cannot help you without your code... not a similar code but THE code which produce that error. Regards, Stefano. -- Ing. Stefano Fontanelli

[sqlalchemy] Re: Cascade Deletes

2011-08-07 Thread Aviv Giladi
I see. Where can I start looking for such an error? What could possibly be causing this? On Aug 7, 6:51 am, Stefano Fontanelli wrote: > Il 07/08/11 00.35, Aviv Giladi ha scritto: > > > Everything works great when I create and assign all 3 subratings to > > the rating object before I add it to th

Re: [sqlalchemy] Re: Cascade Deletes

2011-08-07 Thread Stefano Fontanelli
Il 07/08/11 00.35, Aviv Giladi ha scritto: Everything works great when I create and assign all 3 subratings to the rating object before I add it to the session. However, I need to be able to create a Rating that only has 1 or 2 subratings, and the other subratings absent. When I do that, SQLAlche

[sqlalchemy] Re: Cascade Deletes

2011-08-06 Thread Aviv Giladi
Stefano, Thanks! Your script helped me narrow down the problem. My Rating object has multiple Subrating objects. So in my real code, I have something like: class SubRating1(Base): __tablename__ = 'subratings1' id = Column(Integer, primary_key=True) name = Column(Unicode(32), unique=True

Re: [sqlalchemy] Re: Cascade Deletes

2011-08-06 Thread Stefano Fontanelli
Il 06/08/11 00.32, Aviv Giladi ha scritto: Hi Stefano, I create and add a Rating and Subrating (both end up in the DB no problem). Then, I call session.delete(rating_obj) and commit it. I look at the DB, and the Rating is gone, but the SubRating is still there. The DB shows that the Rating has th

[sqlalchemy] Re: Cascade Deletes

2011-08-05 Thread Aviv Giladi
Hi Stefano, Thanks! The code is just like this: subrating_subratingproperty_association = Table('subrating_subratingproperty_association', Base.metadata, Column('subrating_id', Integer, ForeignKey('subratings.id')), Column('subrating_property_id', Integer, ForeignKey('subrating_properties.id'

Re: [sqlalchemy] Re: Cascade Deletes

2011-08-05 Thread Stefano Fontanelli
Il 05/08/11 20.38, Aviv Giladi ha scritto: Hey Stefano, I tried that, but when I did, this is the error I got while inserting a new rating: InterfaceError: (InterfaceError) Error binding parameter 0 - probably unsupported type. u'SELECT subratings.id AS subratings_id \nFROM subratings \nWHERE s

[sqlalchemy] Re: Cascade Deletes

2011-08-05 Thread Aviv Giladi
Hey Stefano, I tried that, but when I did, this is the error I got while inserting a new rating: InterfaceError: (InterfaceError) Error binding parameter 0 - probably unsupported type. u'SELECT subratings.id AS subratings_id \nFROM subratings \nWHERE subratings.id = ?' (,) On Aug 5, 9:46 am, Ste

Re: [sqlalchemy] Re: Cascade Deletes

2011-08-05 Thread Stefano Fontanelli
Il 04/08/11 21.27, Aviv Giladi ha scritto: Hey, Tried adding cascade to Rating's backref call like so: subrating = relationship("SubRating", backref=backref("rating", cascade="all, delete-orphan" uselist=False)) This unfortunately doesn't work - when I delete a Rating, the according Subra

[sqlalchemy] Re: Cascade Deletes

2011-08-04 Thread Aviv Giladi
Hey, Tried adding cascade to Rating's backref call like so: subrating = relationship("SubRating", backref=backref("rating", cascade="all, delete-orphan" uselist=False)) This unfortunately doesn't work - when I delete a Rating, the according Subratings are NOT removed. What am I doing wrong?

Re: [sqlalchemy] Re: Cascade Deletes

2011-07-31 Thread Stefano Fontanelli
Il 30/07/11 23.24, Aviv Giladi ha scritto: Sorry, but I am really confused. Are you guys saying that on SQLite for example, cascade deletes don't work at all? Or do they work, but are less efficient? ONUPDATE/ONDELETE cascade -> SQL expression: on SQLite and MySQL MyISAM doesn't work at all.

[sqlalchemy] Re: Cascade Deletes

2011-07-30 Thread Aviv Giladi
Sorry, but I am really confused. Are you guys saying that on SQLite for example, cascade deletes don't work at all? Or do they work, but are less efficient? Thanks again! On Jul 30, 11:08 am, Michael Bayer wrote: > SQLAlchemy's "cascade='all, delete-orphan'" implements the same CASCADE > functi

Re: [sqlalchemy] Re: Cascade Deletes

2011-07-30 Thread Michael Bayer
SQLAlchemy's "cascade='all, delete-orphan'" implements the same CASCADE functionality as ONDELETE does, in Python. It is just less efficient since collections need to be fully loaded into memory for them to be processed. On Jul 30, 2011, at 1:49 PM, Aviv Giladi wrote: > Thank you for your res

[sqlalchemy] Re: Cascade Deletes

2011-07-30 Thread Aviv Giladi
Thank you for your response. In that case, how do you manage these kinds of situations in SQLite and other engines in MySQL? Do you manually delete the children as well? On Jul 28, 10:35 am, Stefano Fontanelli wrote: > Il 28/07/11 01.15, Aviv Giladi ha scritto: > > > Hi, > > > I am actually usin

Re: [sqlalchemy] Re: Cascade Deletes

2011-07-28 Thread Stefano Fontanelli
Il 28/07/11 01.15, Aviv Giladi ha scritto: Hi, I am actually using both MySQL and SQLite (one on the dev machine, one on the server). Does that make a difference? ONDELETE and ONUPDATE don't work on SQLite and MySQL MyISAM. You must change your database to test them. In MySQL you can create yo

[sqlalchemy] Re: Cascade Deletes

2011-07-27 Thread Aviv Giladi
Hi, I am actually using both MySQL and SQLite (one on the dev machine, one on the server). Does that make a difference? On Jul 27, 12:26 pm, Michael Bayer wrote: > On Jul 25, 2011, at 9:47 AM, Aviv Giladi wrote: > > > > > > > > > > > I can't seem to make cascade deletes work in sqlalchemy. > > >