> On Dec 15, 2014, at 4:53 AM, jichao liu <[email protected]> wrote:
> 
> procedure something like:
> 
> CREATE  PROCEDURE `NewProc`(IN `groupID_` int,OUT `CountParam_` int)
> BEGIN
>       set @CountParam_ = (select count(1) FROM mytable WHERE GroupID=groupID_ 
> );
> END;
> 
> 
> python:
> 
> counts =  bindparam('CountParam_',isoutparam=True,type_=Integer,value = 0)
> connection = engine.raw_connection()
>     try:
>         cursor = connection.cursor()
>         ss = cursor.callproc("QueryUsersByAuthorID", [user.groupID, counts])
>         results = list(cursor.fetchall())
>         print counts
>         cursor.close()
>         connection.commit()
>     finally:
>         connection.close()
> 
> why it always come out  0 for counts while results get the data?

no idea, that is the DBAPI cursor.  Email the maintainers of MySQLdb, or 
whatever DBAPI it is that you’re using.


> ps. how to get the class obj results for the fetchall() other than tuple at 
> now.

you’d need to build a ResultProxy out of that cursor, then feed it into 
query.instances().   This might not be not very easy to do, so short of 
figuring out that, this feature is not supported right now.




-- 
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.

Reply via email to