[sqlalchemy] Re: how to run a stored procedure?

2010-07-22 Thread Lukasz Szybalski
Hello, What if there is a column that is called state When I try to add use_labels inside the execute statement I get below error. Should I be using the use_labels somewhere else?: a[0].State Traceback (most recent call last): File stdin, line 1, in module File

[sqlalchemy] Re: how to run a stored procedure?

2010-07-21 Thread Lukasz Szybalski
how is calling query(colmames)...all() significantly different from simply saying execute(..).fetchall() ?  you get a list of named-tuple like objects in both cases. You are correct, execute().fetchall() does already returns a list of rows, where each row has attributes. I was initially

[sqlalchemy] Re: how to run a stored procedure?

2010-07-20 Thread Lukasz Szybalski
Session.execute() accepts strings that are converted to text(): a=session.execute(assp_ReportDailyTransactions @start_date=:start,@end_date=:end, params={'start':20100701,'end':20100719}) Thanks, That does work. Is it possible to get each record to be returned as object instead of

Re: [sqlalchemy] Re: how to run a stored procedure?

2010-07-20 Thread Michael Bayer
On Jul 20, 2010, at 4:44 PM, Lukasz Szybalski wrote: Session.execute() accepts strings that are converted to text(): a=session.execute(assp_ReportDailyTransactions @start_date=:start,@end_date=:end, params={'start':20100701,'end':20100719}) Thanks, That does work. Is it possible

[sqlalchemy] Re: how to run a stored procedure?

2010-07-20 Thread Lukasz Szybalski
On Jul 20, 3:46 pm, Michael Bayer mike...@zzzcomputing.com wrote: On Jul 20, 2010, at 4:44 PM, Lukasz Szybalski wrote: Session.execute() accepts strings that are converted to text(): a=session.execute(assp_ReportDailyTransactions @start_date=:start,@end_date=:end,

Re: [sqlalchemy] Re: how to run a stored procedure?

2010-07-20 Thread Michael Bayer
On Jul 20, 2010, at 5:10 PM, Lukasz Szybalski wrote: On Jul 20, 3:46 pm, Michael Bayer mike...@zzzcomputing.com wrote: On Jul 20, 2010, at 4:44 PM, Lukasz Szybalski wrote: Session.execute() accepts strings that are converted to text():

[sqlalchemy] Re: how to run a stored procedure?

2010-07-20 Thread Lukasz Szybalski
On Jul 20, 4:55 pm, Michael Bayer mike...@zzzcomputing.com wrote: On Jul 20, 2010, at 5:10 PM, Lukasz Szybalski wrote: On Jul 20, 3:46 pm, Michael Bayer mike...@zzzcomputing.com wrote: On Jul 20, 2010, at 4:44 PM, Lukasz Szybalski wrote: Session.execute() accepts strings that are

Re: [sqlalchemy] Re: how to run a stored procedure?

2010-07-20 Thread Michael Bayer
On Jul 20, 2010, at 6:19 PM, Lukasz Szybalski wrote: On Jul 20, 4:55 pm, Michael Bayer mike...@zzzcomputing.com wrote: On Jul 20, 2010, at 5:10 PM, Lukasz Szybalski wrote: On Jul 20, 3:46 pm, Michael Bayer mike...@zzzcomputing.com wrote: On Jul 20, 2010, at 4:44 PM, Lukasz

[sqlalchemy] Re: how to run a stored procedure?

2010-07-20 Thread Lukasz Szybalski
On Jul 20, 6:02 pm, Michael Bayer mike...@zzzcomputing.com wrote: On Jul 20, 2010, at 6:19 PM, Lukasz Szybalski wrote: On Jul 20, 4:55 pm, Michael Bayer mike...@zzzcomputing.com wrote: On Jul 20, 2010, at 5:10 PM, Lukasz Szybalski wrote: On Jul 20, 3:46 pm, Michael Bayer

Re: [sqlalchemy] Re: how to run a stored procedure?

2010-07-20 Thread Michael Bayer
On Jul 20, 2010, at 9:39 PM, Lukasz Szybalski wrote: Instead of typing manually column names (column1,column2,...column38 inside the query() I would like to use previous query .keys() to list them there Instead doing:

[sqlalchemy] Re: how to run a stored procedure?

2010-07-19 Thread Lukasz Szybalski
On Jul 15, 3:35 pm, Lukasz Szybalski szybal...@gmail.com wrote: On Jul 15, 2:39 pm, David Gardner dgard...@creatureshop.com wrote: take a look at:http://www.sqlalchemy.org/docs/reference/sqlalchemy/expressions.html?... Now, Could you give me an example of it ? I understand how to run

[sqlalchemy] Re: how to run a stored procedure?

2010-07-19 Thread Lukasz Szybalski
On Jul 19, 10:29 am, Lukasz Szybalski szybal...@gmail.com wrote: On Jul 15, 3:35 pm, Lukasz Szybalski szybal...@gmail.com wrote: On Jul 15, 2:39 pm, David Gardner dgard...@creatureshop.com wrote: take a look at:http://www.sqlalchemy.org/docs/reference/sqlalchemy/expressions.html?...

Re: [sqlalchemy] Re: how to run a stored procedure?

2010-07-19 Thread Michael Bayer
On Jul 19, 2010, at 5:38 PM, Lukasz Szybalski wrote: On Jul 19, 10:29 am, Lukasz Szybalski szybal...@gmail.com wrote: On Jul 15, 3:35 pm, Lukasz Szybalski szybal...@gmail.com wrote: On Jul 15, 2:39 pm, David Gardner dgard...@creatureshop.com wrote: take a look

[sqlalchemy] Re: how to run a stored procedure?

2010-07-15 Thread Lukasz Szybalski
On Jul 15, 2:39 pm, David Gardner dgard...@creatureshop.com wrote: take a look at:http://www.sqlalchemy.org/docs/reference/sqlalchemy/expressions.html?... Now, Could you give me an example of it ? I understand how to run func to get values like current timestamp, or countbut how to run

[sqlalchemy] Re: How to run a stored procedure?

2009-05-11 Thread Daniel
Any reply on this? Should I submit a new bug report? On May 8, 11:49 am, Daniel daniel.watr...@gmail.com wrote: I've just been looking through the code in mssql.py and the change mentioned in the changeset I mentioned isn't there anymore.  I also can't see that's it's been abstracted to a

[sqlalchemy] Re: How to run a stored procedure?

2009-05-11 Thread Michael Bayer
Email on the pyodbc mailing list for instructions on how to execute a stored procedure.The information there will guide how this is done with SQLAlchemy. Daniel wrote: Any reply on this? Should I submit a new bug report? On May 8, 11:49 am, Daniel daniel.watr...@gmail.com wrote: I've

[sqlalchemy] Re: How to run a stored procedure?

2009-05-11 Thread Daniel
Michael, I can execute a stored procedure from SQLAlchemy, but I can't get a result set back out of SQLAlchemy. I've verified that the SP executes as expected and I know that it's returning a result set. I'm following what's been suggested on this forum

[sqlalchemy] Re: How to run a stored procedure?

2009-05-08 Thread Michael Bayer
Daniel wrote: 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

[sqlalchemy] Re: How to run a stored procedure?

2009-05-08 Thread Daniel
Thanks Michael, When I try that it produces this SQL SELECT claim_highest_priority_work() AS claim_highest_priority_work_1 and this error 'claim_highest_priority_work' is not a recognized built-in function name. On May 8, 10:20 am, Michael Bayer mike...@zzzcomputing.com wrote: Daniel wrote:

[sqlalchemy] Re: How to run a stored procedure?

2009-05-08 Thread Michael Bayer
Daniel wrote: Thanks Michael, When I try that it produces this SQL SELECT claim_highest_priority_work() AS claim_highest_priority_work_1 and this error 'claim_highest_priority_work' is not a recognized built-in function name. this is more of an MSSQL how to issue then. on most

[sqlalchemy] Re: How to run a stored procedure?

2009-05-08 Thread Daniel
On mssql, when I run the query, either calling it by name or calling EXEC and then the procedure name, it returns the result. The problem is that if I try to call result.fetchall(), it give this error: ProgrammingError: (ProgrammingError) Attempt to use a closed cursor. None None I know that

[sqlalchemy] Re: How to run a stored procedure?

2009-05-08 Thread Michael Bayer
Daniel wrote: On mssql, when I run the query, either calling it by name or calling EXEC and then the procedure name, it returns the result. The problem is that if I try to call result.fetchall(), it give this error: ProgrammingError: (ProgrammingError) Attempt to use a closed cursor. None

[sqlalchemy] Re: How to run a stored procedure?

2009-05-08 Thread Daniel
Michael, I'm not sure if this helps, but I've noticed that if my stored procedure returns all null values, then I can fetch them. If they are non-null values I get an error: [Dbg] result = conn.execute('claim_highest_priority_work') [Dbg] print result.fetchone() Traceback (most recent call

[sqlalchemy] Re: How to run a stored procedure?

2009-05-08 Thread Daniel
I've just been looking through the code in mssql.py and the change mentioned in the changeset I mentioned isn't there anymore. I also can't see that's it's been abstracted to a parent class. Is there a possibility that this bug has crept back in? If so, let me know where the sensible place