Thank you so much guys! Now I figured it out. Hope this will help someone else as well :)
On Feb 2, 9:53 pm, MikeCo <mconl...@gmail.com> wrote: > Commit behavior depends on how you configure the session's autocommit > property. Follow the log messages in this little test. > > from sqlalchemy import MetaData, Table, Column, String > from sqlalchemy.orm import sessionmaker > meta = MetaData('sqlite:///') > Session = sessionmaker(bind=meta.bind) > t = Table('something',meta, > Column('stuff',String) > ) > > print '+++++++++ create_all()' > meta.create_all() > meta.bind.echo=True > > session1 = Session(autocommit=False) # this is default behavior > print '+++++++++ execute() will not include commit' > session1.execute("insert into something(stuff) values('some stuff')") > print '+++++++++ commit() need to do it yourself' > session1.commit() > > session2 = Session(autocommit=True) # commit is configurable > print '+++++++++ execute() will include commit' > session2.execute("insert into something(stuff) values('some more > stuff')") > > On Feb 2, 1:15 pm, Bob Farrell <robertanthonyfarr...@googlemail.com> > wrote: > > > On Mon, Feb 02, 2009 at 09:56:15AM -0800, Pavel Skvazh wrote: > > > > Session.execute('INSERT INTO SOMETHING SOMETHING / DELETE/ UPDATE') > > > > Do I have to call Session.commit() after this or it's already taken > > > care of? In other words does the literal sql statements follow the > > > session transaction rules or they act on there own? > > > sess.execute() will execute whatever you pass it immediately. > > > > And since this works and worked for me for a long time now, what's the > > > benefit of from sqlalchemy.sql import text that I noticed in the docs > > > lately? > > > Using text() creates a ClauseElement that you can whack together with other > > constructs. See the docs here for more > > info:http://www.sqlalchemy.org/docs/05/sqlexpression.html#using-text > > > > Thanks! > > > -- > > -------------------------- > > Bob Farrell > > pH, an Experian Companywww.phgroup.com > > Office Line: 020 7598 0310 > > Fax: 020 7598 0311 > > -------------------------- > > --~--~---------~--~----~------------~-------~--~----~ 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 sqlalchemy+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en -~----------~----~----~----~------~----~------~--~---