[sqlalchemy] Re: ondelete cascade with turbogears/SA

2007-08-16 Thread James

just to make sure I'm understanding this:
 even though mysql is configured to cascade deletes for this
relationship, SA needs to be told about it so that it doesn't prevent
it from cascading by first nulling the foreign key?

I tried this:
class Account(ActiveMapper):
class mapping:
__table__ = account
id  = column(Integer, primary_key=True)
account_name= column(Unicode(50), unique=True)
number  = column(Unicode(50), unique=True)
users   = one_to_many('User', passive_deletes=True,
cascade='delete')

but got this:
TypeError: __init__() got an unexpected keyword argument
'passive_deletes'

I think the problem is the TG layer is getting in the way.  I may need
to use SA directly here to do this.




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



[sqlalchemy] Re: ondelete cascade with turbogears/SA

2007-08-16 Thread Michael Bayer



On Aug 16, 11:48 am, James [EMAIL PROTECTED] wrote:
 just to make sure I'm understanding this:
  even though mysql is configured to cascade deletes for this
 relationship, SA needs to be told about it so that it doesn't prevent
 it from cascading by first nulling the foreign key?

yes more or less...whatever is currently loaded in the session, its
still going to process explicitly regardless of CASCADE rules in your
database.  so the cascade=all, delete makes sure those two sides are
in agreement with what needs to be done.


 I think the problem is the TG layer is getting in the way.  I may need
 to use SA directly here to do this.

yes ActiveMapper probably does not support that argument.  Elixir is a
better way to go if you want the declarative pattern.


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



[sqlalchemy] Re: ondelete cascade with turbogears/SA

2007-08-16 Thread James

I've seen some of the Elixir info and thought it was too new to start
using just yet.
How hard is it to transition from ActiveMapper to Elixir, given a
moderately sized model and a moderate amount of access by controllers?

If I go with direct access to SA API in model, where do the
cascade='delete' and passive_deletes=True items belong?

thanks,
James


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