On Jun 15, 2011, at 11:28 AM, Chris Withers wrote:

> Hi All,
> 
> So, if I have a MySQL function, I can call it as follows:
> 
> result = session.execute(func.myfunc()).scalar()
> 
> However, if that is instead a procedure, I get:
> 
> OperationalError: (OperationalError) (1305, 'FUNCTION myfunc does not exist') 
> 'SELECT myfunc() AS myfunc_1')
> 
> I *do* get the correct result with:
> 
> session.execute('call myfunc()').scalar()
> 
> ...but is there a way I can generate that?

i havent worked with MySQL sps but maybe there's a way to CREATE FUNCTION 
instead of SP, not sure, otherwise you'd probably want to do this:

class Call(ClauseElement):
    def __init__(self, name):
        self.name = name

@compiles(Call)
def _call(expression, compiler, **kw):
    return "CALL %s" % expression.name



> 
> cheers,
> 
> Chris
> 
> -- 
> Simplistix - Content Management, Batch Processing & Python Consulting
>           - http://www.simplistix.co.uk
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "sqlalchemy" group.
> To post to this group, send email to sqlalchemy@googlegroups.com.
> To unsubscribe from this group, send email to 
> sqlalchemy+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/sqlalchemy?hl=en.
> 

-- 
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To post to this group, send email to sqlalchemy@googlegroups.com.
To unsubscribe from this group, send email to 
sqlalchemy+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en.

Reply via email to