[sqlalchemy] 0.6 and c extensions

2010-03-21 Thread drakkan
Hi, a really interesting feature in sa 0.6 are the c extensions, however I think they should be implemented using ctypes so if python ctypes extension is available (default in python =2.5 and available even for 2.4) the c extensions are used as default, using ctypes no compilation is needed you

Re: [sqlalchemy] 0.6 and c extensions

2010-03-21 Thread Antoine Pitrou
Le dimanche 21 mars 2010 à 02:10 -0700, drakkan a écrit : Hi, a really interesting feature in sa 0.6 are the c extensions, however I think they should be implemented using ctypes so if python ctypes extension is available (default in python =2.5 and available even for 2.4) the c extensions

Re: [sqlalchemy] SQLAlchemy 0.6beta2 released

2010-03-21 Thread Manlio Perillo
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Michael Bayer ha scritto: SQLAlchemy 0.6beta2 is now available.This beta may be the last before the 0.6.0 final release. We've hopefully gotten every largish change into the release as possible so that people can test. 0.6 is already

Re: [sqlalchemy] SQLAlchemy 0.6beta2 released

2010-03-21 Thread Michael Trier
Hello, On Mar 21, 2010, at 10:43 AM, Manlio Perillo wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Michael Bayer ha scritto: SQLAlchemy 0.6beta2 is now available.This beta may be the last before the 0.6.0 final release. We've hopefully gotten every largish change into the

[sqlalchemy] Re: 0.6 and c extensions

2010-03-21 Thread drakkan
On 21 Mar, 14:31, Antoine Pitrou solip...@pitrou.net wrote: Le dimanche 21 mars 2010 à 02:10 -0700, drakkan a écrit : Hi, a really interesting feature in sa 0.6 are the c extensions, however I think they should be implemented using ctypes so if python ctypes extension is available

Re: [sqlalchemy] SQLAlchemy 0.6beta2 released

2010-03-21 Thread Michael Bayer
On Mar 21, 2010, at 10:43 AM, Manlio Perillo wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Michael Bayer ha scritto: What about ticket #1679, for SQL Schema support? the patch needs to be re-added. CREATE SCHEMA / DROP SCHEMA is also not going to have any connection to the

Re: [sqlalchemy] Re: 0.6 and c extensions

2010-03-21 Thread Gaetan de Menten
On Sun, Mar 21, 2010 at 17:13, drakkan drakkan1...@gmail.com wrote: On 21 Mar, 14:31, Antoine Pitrou solip...@pitrou.net wrote: Le dimanche 21 mars 2010 à 02:10 -0700, drakkan a écrit : a really interesting feature in sa 0.6 are the c extensions, however I think they should be implemented

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

[sqlalchemy] Re: @comparable_using

2010-03-21 Thread Matthew
I got around this by switching to declarative and declaring my property like this: _id = column_property(Column(id,Integer,primary_key=True), comparator_factory=some_comparator_factory()) And then used @synonym_for for the getter: @synonym_for(_id) @property def id(self):

Re: [sqlalchemy] Re: @comparable_using

2010-03-21 Thread Michael Bayer
On Mar 21, 2010, at 6:20 PM, Matthew wrote: I got around this by switching to declarative and declaring my property like this: _id = column_property(Column(id,Integer,primary_key=True), comparator_factory=some_comparator_factory()) And then used @synonym_for for the getter:

Re: [sqlalchemy] Re: @comparable_using

2010-03-21 Thread Kevin Wormington
After fixing my cutpaste problem I just get DB2 sql errors from the sample code. I'm going to turn on some more logging in db2 and see what is actually reaching it. Kevin Matthew wrote: I got around this by switching to declarative and declaring my property like this: _id =

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

[sqlalchemy] recommended declarative method design pattern for sessions

2010-03-21 Thread Daniel Robbins
Hi All, One of the things that doesn't seem to be covered in the docs, and that I'm currently trying to figure out, is the recommended design pattern to use for managing sessions from declarative methods calls. Consider a declarative class User, where I want to implement a FindFriends()