Hi,
As we discussed it later on in IRC channel, not too much.

I always mentioned I just started learn Werkzeug, Jinja2 and
SQLAlchemy. I found following in SA docs:

http://www.sqlalchemy.org/docs/05/session.html#using-create-session

"""Note that the defaults of create_session() are the opposite of that
of sessionmaker(): autoflush and expire_on_commit are False,
autocommit is True. It is recommended to use the sessionmaker()
function instead of create_session(). create_session() is used to get
a session with no automation turned on and is useful for testing."""

To me on one hand it makes a code a little bit shorter because I don't
need specify autoflush=True, autocommit=False, because of sessionmaker
() defaults. But on the other hand, create_session looks more
transparent and doesn't require "()" at the end like ssesionmaker()
does.

By the way can somebody explain me this trick "()":

session = scoped_session(lambda: sessionmaker
(bind=application.database_engine)(), local_manager.get_ident)

Cheers,
VP





On Sep 18, 5:51 pm, Armin Ronacher <[email protected]>
wrote:
> Hi,
>
> VP schrieb:> This works:
>
> > session = scoped_session(lambda: sessionmaker
> > (bind=application.database_engine)(), local_manager.get_ident)
>
> And what does that give you over create_session?
>
> Regards,
> Armin
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"pocoo-libs" 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/pocoo-libs?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to