Re: [sqlalchemy] List Objects To Be Deleted

2014-07-15 Thread Scott Meisburger
fabulous, this works great. thanks! now I've got something like this in my code: def delete_cascade_preview(instance): keys = [rel.key for rel in inspect(instance.__class__).relationships if rel.cascade.delete == True] return {key:getattr(instance, key).all() for key in keys if getattr(

Re: [sqlalchemy] List Objects To Be Deleted

2014-07-15 Thread Michael Bayer
I'd look at inspect(MyClass).relationships to see where the linkages are to other classes. Then you can probe those for the features you need - once you have one, it has a string "key". you can then see that by just getattr(someobj, "somekey"). On Jul 15, 2014, at 3:40 PM, Scott Meisburger

[sqlalchemy] List Objects To Be Deleted

2014-07-15 Thread Scott Meisburger
I've got an app where through an admin interface, a user can delete objects in the database. This happens via: db.session.delete(obj) db.session.commit() There are cascade rules defined in Python for these objects (using the ORM). What I want to do is display to the user a list of related objec