Thus spake Michael Bayer ([EMAIL PROTECTED]):

when you mark an item as "deleted" in the session, no SQL is issued nor
does any transaction occur (if you havent started one already).  it
would not be the appropriate point in time to do "accounting"
operations, since those operations are not part of any transaction - if
you lose your session, an error occurs, etc., now you have "accounting"
data which is incorrect.

Well... yes. A notification mechanism would be agnostic about this (like the
current MapperExtension is), and trust the programmer not to do something
silly.


if you do in fact want to increment a counter based on the mere
"marking" of an object for deletion, even if the operation ultimately
fails or is never even called, that sounds more like an business-layer
thing, for which no "hook" in SA is needed; you should instead write a
facade of your own around SA's Session to handle whatever business
cases you need associated with this particular deletion operation.  As
SA is only a library and not a framework, its not in the business of
being the place to hang business-logic events.

I'm doing something similar to what you describe at the moment. I still have a
feeling that the need to subscribe to session operations on mapped objects will
be a common one.  Wrapping Session places restrictions on how users of the data
model can acquire a session (ie.  they'd have to do so through an interface
provided by me). This is a decision I'd prefer to leave up to the programmer,
for obvious reasons.  Perhaps a nice way to globally extend Session is called
for?

At any rate, it is a perfectly respectable design decision to say that this
particular problem is out of scope for SQLAlchemy - and knowing where the line
is drawn at least makes MY design decision simple... ;)




Cheers,



Aldo



--
Aldo Cortesi
[EMAIL PROTECTED]
http://www.nullcube.com
Mob: 0419 492 863

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

Reply via email to