Re: [sqlalchemy] callproc support

2010-03-22 Thread Kevin Wormington
That's getting closer. Now if I could just figure out how to get it to use the parameters that I'm actually passing in engine.execute. It appears ibm_db_sa botches the sql (to CALL BILLING.subscriber_balance()) if use the commented out cursor.callproc(statement, parameters). from

Re: [sqlalchemy] callproc support

2010-03-22 Thread Michael Bayer
On Mar 22, 2010, at 3:48 PM, Kevin Wormington wrote: That's getting closer. Now if I could just figure out how to get it to use the parameters that I'm actually passing in engine.execute. It appears ibm_db_sa botches the sql (to CALL BILLING.subscriber_balance()) if use the commented

Re: [sqlalchemy] callproc support

2010-03-22 Thread Kevin Wormington
Michael Bayer wrote: On Mar 22, 2010, at 3:48 PM, Kevin Wormington wrote: That's getting closer. Now if I could just figure out how to get it to use the parameters that I'm actually passing in engine.execute. It appears ibm_db_sa botches the sql (to CALL BILLING.subscriber_balance()) if

Re: [sqlalchemy] callproc support

2010-03-22 Thread Michael Bayer
On Mar 22, 2010, at 4:06 PM, Kevin Wormington wrote: Michael Bayer wrote: On Mar 22, 2010, at 3:48 PM, Kevin Wormington wrote: That's getting closer. Now if I could just figure out how to get it to use the parameters that I'm actually passing in engine.execute. It appears ibm_db_sa

Re: [sqlalchemy] callproc support

2010-03-21 Thread Michael Bayer
On Mar 21, 2010, at 12:50 PM, Kevin Wormington wrote: Hi, I am using SQLAlchemy 0.5.8 with the ibm_db_sa (DB2) adapter and I am wanting to add simple session.callproc support so that I can get results from stored procedures that don't use a select or table format. I haven't done any

Re: [sqlalchemy] callproc support

2010-03-21 Thread Kevin Wormington
Michael Bayer wrote: On Mar 21, 2010, at 12:50 PM, Kevin Wormington wrote: Hi, I am using SQLAlchemy 0.5.8 with the ibm_db_sa (DB2) adapter and I am wanting to add simple session.callproc support so that I can get results from stored procedures that don't use a select or table format. I

Re: [sqlalchemy] callproc support

2010-03-21 Thread Kevin Wormington
I get the following when trying the example implemention: Traceback (most recent call last): File test.py, line 6, in module class procedure(ClauseElement): File test.py, line 15, in procedure @compiles(procedure) NameError: name 'procedure' is not defined Here is the code for that

Re: [sqlalchemy] callproc support

2010-03-21 Thread Kevin Wormington
Please disregard...cut paste messed up the indention. Kevin Wormington wrote: I get the following when trying the example implemention: Traceback (most recent call last): File test.py, line 6, in module class procedure(ClauseElement): File test.py, line 15, in procedure

Re: [sqlalchemy] callproc support

2010-03-21 Thread Kevin Wormington
From DB2 logs it appears that the following is what's getting sent to DB2 and resulting in the error: CALL BILLING.subscriber_balance(1000,?)( ) This is using: print engine.execute(procedure(BILLING.subscriber_balance, subid, ?)) Any idea how I can get rid of the extra set of ()'s?

Re: [sqlalchemy] callproc support

2010-03-21 Thread Michael Bayer
On Mar 21, 2010, at 5:44 PM, Kevin Wormington wrote: I have tried several different ways of getting plain execute to work including via the low-level ibm_db.execute interface with no luck. I have also tried changing the DB2 side to be a function instead of a stored procedure so that

Re: [sqlalchemy] callproc support

2010-03-21 Thread Michael Bayer
On Mar 21, 2010, at 7:34 PM, Kevin Wormington wrote: From DB2 logs it appears that the following is what's getting sent to DB2 and resulting in the error: CALL BILLING.subscriber_balance(1000,?)( ) This is using: print engine.execute(procedure(BILLING.subscriber_balance, subid,

Re: [sqlalchemy] callproc support

2010-03-21 Thread Kevin Wormington
Michael Bayer wrote: On Mar 21, 2010, at 5:44 PM, Kevin Wormington wrote: I have tried several different ways of getting plain execute to work including via the low-level ibm_db.execute interface with no luck. I have also tried changing the DB2 side to be a function instead of a stored

Re: [sqlalchemy] callproc support

2010-03-21 Thread Kevin Wormington
2010-03-21 18:40:49,656 INFO sqlalchemy.engine.base.Engine.0x...cb0c calling stored procedure: BILLING.subscriber_balance(1000,?) INFO:sqlalchemy.engine.base.Engine.0x...cb0c:calling stored procedure: BILLING.subscriber_balance(1000,?) It looks correct there but all that is getting logged is

Re: [sqlalchemy] callproc support

2010-03-21 Thread Kevin Wormington
I just modified the compile to return just the procedure name and the cursor.callproc to send the statement and the two parameters as a tuple and the DB2 receives the correct SQL: CALL BILLING.subscriber_balance(?,?) But I get the following back from ibm_db_dbi: return

Re: [sqlalchemy] callproc support

2010-03-21 Thread Kevin Wormington
It appears this is some issue with ibm_db_dbi. I tried it using just the ibm_db_dbi calls and no SA and get the same error msg: CLI0150E Driver not capable. Explanation: The operation is valid but not supported by either the driver or the data source. User response: Specify a valid

Re: [sqlalchemy] callproc support

2010-03-21 Thread Michael Bayer
On Mar 21, 2010, at 8:07 PM, Kevin Wormington wrote: I just modified the compile to return just the procedure name and the cursor.callproc to send the statement and the two parameters as a tuple and the DB2 receives the correct SQL: CALL BILLING.subscriber_balance(?,?) But I get the

Re: [sqlalchemy] callproc support

2010-03-21 Thread Kevin Wormington
I was able to get it working from just the ibm_db_dbi interface - the actual call has to be: cursor.callproc('BILLING.subscriber_balance',(subid,balance)) these both cause the sql errors: cursor.callproc('BILLING.subscriber_balance',(1000,0))

Re: [sqlalchemy] callproc support

2010-03-21 Thread Kevin Wormington
As a test I altered the compile_procedure and the call to cursor.callproc and do get the values back from the stored procedure from the print res before the return. I get exceptions about the cursor being close when I try to access the ResultProxy object returned though. I think it's because

Re: [sqlalchemy] callproc support

2010-03-21 Thread Michael Bayer
On Mar 21, 2010, at 9:33 PM, Kevin Wormington wrote: As a test I altered the compile_procedure and the call to cursor.callproc and do get the values back from the stored procedure from the print res before the return. I get exceptions about the cursor being close when I try to access the