On May 25, 2010, at 10:24 AM, Torsten Landschoff wrote:

> Hi Michael,
> 
> thanks for your fast reply. How do you keep up with all this email?
> 
> On Tue, 2010-05-25 at 10:08 -0400, Michael Bayer wrote:
> 
>> I suppose you could try subclassing Session or perhaps seeing if the hooks 
>> provided with SessionExtension (I'm thinking the attach hook) give you 
>> enough to go on here.   Or, probably easier, just build yourself a wrapper 
>> class that looks like Session but proxies requests to it, after passing 
>> through your checks for current transaction active.
> The attach hook would suffice to catch the session.add of new objects. 
> However, this is not my core interest, as it is highly unlikely that somebody 
> calls this by accident.
> 
> My goal is to catch property writes on mapped attributes. So I will probably 
> need an AttributeExtension, but I don't know how to access the session state 
> from there.
>> It should go without saying that Clojure is from an entirely different 
>> philosophy than that of Python and SQLAlchemy (its author is hostile to the 
>> entire concept of object oriented design), so imitating particular behaviors 
>> of Clojure is not a core goal of the project.
> :-) I don't know from what you infer that Rich is hostile to OO design. Of 
> course I don't ask from SQLAlchemy to imitate Clojure. It's just that I find 
> Clojures behaviour in this single context more intuitive.
> I thought it would be a neat feature to support this kind of protection in 
> SQLAlchemy. Your mileage may vary.


so, you literally want to disallow "foo.x = 'bar'" outside of a transaction, 
huh.  Yeah, no SQL is actually emitted at that point so it would appear you'd 
need a lot of points at which you're trapping "writes".

Hickey referred to OO as "the spaghetti code of the 90s" or something similar 
in a talk I saw.  He basically said it had failed on delivering on the promise 
it gave over procedural programming and simply changed the nature of 
"spaghetti" into something equally bad.  He wasn't quite as militant as Joe 
Armstrong (erlang creator), but close.   


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