[sqlalchemy] how to run a stored procedure?
Hello, I need to get data out of sqlserver by running this stored procedure. From there I convert few fields and add the processed rows to a mysql table that I have created. How can I do the following in sqlalchemy? Is there a pythonic way? Assuming I already have the database connection? What would be the syntax to run a stroed procedure? And what object would the results be in? USE [Reports] GO DECLARE @return_value int EXEC@return_value = [dbo].[assp_Report_DailyTransactions] @start_date = N'07/01/2010', @end_date = N'07/15/2010' SELECT 'Return Value' = @return_value Thanks, Lucas -- You received this message because you are subscribed to the Google Groups sqlalchemy group. To post to this group, send email to sqlalch...@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.
Re: [sqlalchemy] how to run a stored procedure?
take a look at: http://www.sqlalchemy.org/docs/reference/sqlalchemy/expressions.html?highlight=sql.func#sqlalchemy.sql.expression.func On 07/15/2010 12:29 PM, Lukasz Szybalski wrote: Hello, I need to get data out of sqlserver by running this stored procedure. From there I convert few fields and add the processed rows to a mysql table that I have created. How can I do the following in sqlalchemy? Is there a pythonic way? Assuming I already have the database connection? What would be the syntax to run a stroed procedure? And what object would the results be in? USE [Reports] GO DECLARE @return_value int EXEC@return_value = [dbo].[assp_Report_DailyTransactions] @start_date = N'07/01/2010', @end_date = N'07/15/2010' SELECT 'Return Value' = @return_value Thanks, Lucas -- David Gardner Pipeline Tools Programmer Jim Henson Creature Shop dgard...@creatureshop.com -- You received this message because you are subscribed to the Google Groups sqlalchemy group. To post to this group, send email to sqlalch...@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.
[sqlalchemy] How to run a stored procedure?
Hello, I've created a stored procedure in MSSQL. I'm not sure how to use it in SQLAlchemy. The stored procedure is called 'claim_highest_priority_work' and I can call it directly as follows: result = conn.execute('claim_highest_priority_work') I know it runs because I see the result in the database, but I'm not sure how to access the return values? They exactly match one of the tables I've defined. What's the right way to map/execute a stored procedure and subsequently access what it returns? Thanks --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---