I can help you with part of this.
your CountParam_ and your @CountParam_ are DIFFERENT variables.....
the OUT param is local to the stored proc and is returned by a bind thru
the DBapi
the @ param is GLOBAL to your current MySQL session -- can only be
retrieved by SELECT
If you want to have the result value passed back to you directly, then you
must do as Mike suggested and work with the specifics of the DBAPI.
If you don't mind issuing another query, you can get your value back via
query RIGHT AFTER you run the stored proc....like:
Select @CountParam_ ;
Hope this helps!
D
On Monday, December 15, 2014 3:53:10 AM UTC-6, jichao liu 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?
>
> is my way calling the procedure correct or something else.
>
> ps. how to get the class obj results for the fetchall() other than tuple
> at 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.