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 >>>> 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 count....but how to run a >>> stored proc? >> >>> print >>> func.assp_Report_DailyTransactions(start_date='20100701',end_date='20100715') >>> ?????????? >>> Is this the format? or? >> >> Any idea what the proper format should be? >> I was able to connect to the mssql database vi instance name on linux. >> I've updated the docs on how to setup your odbc dsn connection >> string:http://lucasmanual.com/mywiki/unixODBC >> >> Now that I'm connected how do I execute, pass in variables like start >> and end date? > > Hello, > > I can do this: > > l=session.execute("assp_ReportDailyTransactions") > > but this returns all the data, > > In both pyODBC and ceODBC I can run the following which will return > proper data range based on start and end date parameters. > > a=cursor.execute("assp_ReportDailyTransactions @start_date=?, > @end_date=?","20100701","20100719") > > but how do I convert that to sqlalchemy like format:
Session.execute() accepts strings that are converted to text(): session.execute("assp_ReportDailyTransactions @start_date=:start,@end_date=:end", params={'start':"20100701",'end':"20100719"}) > > This gives the following error: > session.execute("assp_ReportDailyTransactions @start_date=?, > @end_date=?","20100701","20100719") > Traceback (most recent call last): > File "<stdin>", line 1, in <module> > File "/home/lucas/tmp/sql2008/env/lib/python2.5/site-packages/ > SQLAlchemy-0.6.3-py2.5.egg/sqlalchemy/orm/session.py", line 732, in > execute > engine = self.get_bind(mapper, clause=clause, **kw) > File "/home/lucas/tmp/sql2008/env/lib/python2.5/site-packages/ > SQLAlchemy-0.6.3-py2.5.egg/sqlalchemy/orm/session.py", line 837, in > get_bind > c_mapper = mapper is not None and _class_to_mapper(mapper) or None > File "/home/lucas/tmp/sql2008/env/lib/python2.5/site-packages/ > SQLAlchemy-0.6.3-py2.5.egg/sqlalchemy/orm/util.py", line 636, in > _class_to_mapper > raise exc.UnmappedClassError(class_or_mapper) > sqlalchemy.orm.exc.UnmappedClassError: Class ''20100719'' is not > mapped > > Let me know, > 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. > -- 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.