Re: [sqlalchemy] HOW TO HANDLE SPECIAL CHARACTERS WITH ENGINE.EXECUTE

2012-02-12 Thread Krishnakant Mane
On 11/02/12 21:10, Michael Bayer wrote: def execproc(procname, engine, queryParams=[]): function = getattr(func, procname) function_with_params = function(*queryParams) return engine.execute(function_with_params.execution_options(autocommit=True)) Hi Michael, I tryed this

Re: [sqlalchemy] HOW TO HANDLE SPECIAL CHARACTERS WITH ENGINE.EXECUTE

2012-02-12 Thread Michael Bayer
On Feb 12, 2012, at 5:22 AM, Krishnakant Mane wrote: On 11/02/12 21:10, Michael Bayer wrote: def execproc(procname, engine, queryParams=[]): function = getattr(func, procname) function_with_params = function(*queryParams) return

Re: [sqlalchemy] HOW TO HANDLE SPECIAL CHARACTERS WITH ENGINE.EXECUTE

2012-02-12 Thread Krishnakant Mane
On 12/02/12 22:01, Michael Bayer wrote: On Feb 12, 2012, at 5:22 AM, Krishnakant Mane wrote: On 11/02/12 21:10, Michael Bayer wrote: def execproc(procname, engine, queryParams=[]): function = getattr(func, procname) function_with_params = function(*queryParams) return

Re: [sqlalchemy] HOW TO HANDLE SPECIAL CHARACTERS WITH ENGINE.EXECUTE

2012-02-12 Thread Krishnakant Mane
Hi again, Mikeal, I am sorry, I was half asleep when I went through the code, This week long sprint on our project has tired me out. I think its pritty clear now. (unless you would love to explain the last 2 llines for clearity sake ). Happy hacking. Krishnakant. On 12/02/12 22:01, Michael Bayer

Re: [sqlalchemy] HOW TO HANDLE SPECIAL CHARACTERS WITH ENGINE.EXECUTE

2012-02-12 Thread Michael Bayer
Here's another one that is without the SQL expression stuff, perhaps it is easier to understand: def execproc(procname, engine, queryParams=[]): conn = engine.connect() try: trans = conn.begin() result = conn.execute( SELECT * FROM %s(%s) % (

Re: [sqlalchemy] HOW TO HANDLE SPECIAL CHARACTERS WITH ENGINE.EXECUTE

2012-02-12 Thread Krishnakant Mane
Hi Michael, Excelent work, you are a real artist. Just wished to know what is the trans object, and do i need to use a connection object for the thing to work? I mean, do I need the conn = engine.connect() line? I already have a set of live engines so I never make an extra connection in my

Re: [sqlalchemy] HOW TO HANDLE SPECIAL CHARACTERS WITH ENGINE.EXECUTE

2012-02-12 Thread Michael Bayer
Transaction is a SQLAlchemy object that represents the scope of the transaction within the DBAPI. The DBAPI always presents a transaction, that's why the pure DBAPI version calls conn.commit() at the end. You could also say conn = engine.connect().execution_options(autocommit=True). On Feb

Re: [sqlalchemy] HOW TO HANDLE SPECIAL CHARACTERS WITH ENGINE.EXECUTE

2012-02-12 Thread Krishnakant Mane
On 13/02/12 02:19, Michael Bayer wrote: Transaction is a SQLAlchemy object that represents the scope of the transaction within the DBAPI. The DBAPI always presents a transaction, that's why the pure DBAPI version calls conn.commit() at the end. So does that mean I will have to use a

[sqlalchemy] HOW TO HANDLE SPECIAL CHARACTERS WITH ENGINE.EXECUTE

2012-02-11 Thread Krishnakant Mane
Hello all, I have an interesting problem for which I am sure some simple solution must be existing. I have made a Python function which I will paist below. Basically what the function does is that it takes 3 parameters, namely the name of a stored procedure, engine instance and a set of

Re: [sqlalchemy] HOW TO HANDLE SPECIAL CHARACTERS WITH ENGINE.EXECUTE

2012-02-11 Thread Michael Bayer
On Feb 11, 2012, at 8:02 AM, Krishnakant Mane wrote: Hello all, I have an interesting problem for which I am sure some simple solution must be existing. I have made a Python function which I will paist below. Basically what the function does is that it takes 3 parameters, namely the name

Re: [sqlalchemy] HOW TO HANDLE SPECIAL CHARACTERS WITH ENGINE.EXECUTE

2012-02-11 Thread Krishnakant Mane
Thanks Michael, I will see if this works perfectly with postgresql. I had tryed func before but did not get any success. May be this time it will work. Happy hacking. Krishnakant. On 11/02/12 21:10, Michael Bayer wrote: On Feb 11, 2012, at 8:02 AM, Krishnakant Mane wrote: Hello all, I have an