OK looks like create_session() won't work I need to explicitly bind the session to an engine: Session = sessionmaker(bind=engine, autoflush=False, autocommit=True) session = Session()
David Gardner wrote: > I'm trying to disable the server side triggers on one of my tables > before I run some maintenance code on the table. > What I am wondering is will the code below work the way I think/hope it > will? > > -------------- > > session=create_session() > session.begin(subtransactions=True) > try: > con = session.connection() > tmp = con.execute("""ALTER TABLE farm.frame DISABLE TRIGGER ALL;""") > > # bunch of ORM code here in a big for loop > > tmp = con.execute("""ALTER TABLE farm.frame ENABLE TRIGGER ALL;""") > > except Exception,e: > session.rollback() > print str(e) > sys.exit(1) > > > -- David Gardner Pipeline Tools Programmer Jim Henson Creature Shop dgard...@creatureshop.com --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---