On Jun 1, 2007, at 6:47 PM, Mike Orr wrote:

> (4) I haven't used so I'm not sure if it's better or worse than
> session.* .  But grafting fewer rather than more methods onto the
> mapped class makes sense.

instance.flush() is often misused, since flush() with just one  
instance wont always flush dependent instances.  session.flush() is  
preferred, so ive considered whacking this since i think  
instance.flush() is not as common a use case as people might think  
(and they can say session.flush([instance]) if they really want the  
single-instance flush).

>>     5  connecting a DynamicMetaData whenever it needs to
>
> (5) is maybe being done by the session_context rather than
> assign_mapper, so perhaps it doesn't apply here.  I just saw a Pylons
> recipe that said you can use a DynamicMetaData in your model *if* you
> use assign_mapper; I'm not sure why.
> http://docs.pythonweb.org/display/pylonscookbook/SQLAlchemy+for 
> +people+in+a+hurry
>

wellll assignmapper has  nothing to do with metadata or engines at  
all. also i kind of want to log in and edit that.  DynamicMetaData,  
it was recently agreed, is not of general use.  it connects to a  
particular engine within the current thread only.  Pylons generally  
does not require any engine to be bound to the metadata at all since  
it binds the engine to the session.

> Given that all this is in control of the session_context, why not make
> assign_mapper a method of it, with boolean flags to enable method
> decoration:
>
> session_context.map(MyClass, table, query_methods=True,  
> session_methods=True)
>
> or:
>
> session_context.query_methods = True
> session_context.session_methods = True
> session_context.map(MyClass, table)
>

i think assignmapper is a much more second class citizen than  
session_context.  people are at last talking about making their own  
common base class with actual methods on them, instead of using any  
of this monkeypatch stuff.

> If we hang the query methods off .query(), can we hang the session
> methods off .session()?  Or .store.  (But not .objectstore, ugh.)

.session maybe.

>
> .query() is a class method that's actually a lambda.  Very strange.
> The other methods looked like they were assigned more
> straightforwardly but maybe that's just a superficial appearance.
> They don't use lambdas though.

i use lambdas for short anonymous functions all the time ? oh well i  
guess im under arrest by the style police again..... (repeat  
offender...)



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

Reply via email to