[sqlalchemy] automap_base with mapped class

2017-03-10 Thread Vijaya Sekar
from sqlalchemy.ext.automap import automap_base from sqlalchemy import create_engine, MetaData lists = ['employees','address'] engine = create_engine("sqlite:///chinook.db") metadata = MetaData() metadata.reflect(engine, only=lists) Base = automap_base(metadata=metadata) Base.prepare() User =

Re: [sqlalchemy] ORA-03113 Sqlalchmy During Multiprocessing

2017-03-10 Thread mike bayer
with multiprocessing, you have to make sure you are using an empty engine at the start of each process, or have otherwise arranged for connections to be refreshed in the new process; the database connections in an engine are pooled, and if you transfer those connections to a new process it

Re: [sqlalchemy] Looks like there is no event to catch "before" a rollback happens

2017-03-10 Thread Simon King
On Fri, Mar 10, 2017 at 4:12 PM, Alessandro Molina wrote: > > > On Fri, Mar 10, 2017 at 3:40 PM, mike bayer > wrote: >> >> If this is truly, "unexpected error but we need to do things", perhaps you >> can use before_flush() to memoize the

Re: [sqlalchemy] Looks like there is no event to catch "before" a rollback happens

2017-03-10 Thread Alessandro Molina
On Fri, Mar 10, 2017 at 3:40 PM, mike bayer wrote: > If this is truly, "unexpected error but we need to do things", perhaps you > can use before_flush() to memoize the details you need for a restore inside > of session.info. > > An event hook can be added but it would

[sqlalchemy] ORA-03113 Sqlalchmy During Multiprocessing

2017-03-10 Thread Emeka Chibuzor
I get ORA-03113 all the time both using sqlalchemy raw sql and using Sqlalchemy to select. Can some one help me to check if they is a problem with my connection string or if they is some thing Missing. def connect(): try: return cx_Oracle.Connection(connstring) except

Re: [sqlalchemy] Looks like there is no event to catch "before" a rollback happens

2017-03-10 Thread mike bayer
On 03/10/2017 01:57 AM, Alessandro Molina wrote: I have been looking for a way to know what's going to be rolled back in SQLAlchemy so that I can know what was changed and restore other database unrelated things to their previous state. By