Re: [sqlalchemy] Can sqlalchemy set temp variables?

2015-01-06 Thread lee
I ran in to a similar problem and was able to do something like this: DBSession.execute(set @temp=0;) DBSession.execute(Select @temp, ;) I tried using the raw_connection but that ended up not working due to different transactions. Above approach is working for now. On Wednesday, December

[sqlalchemy] Can sqlalchemy set temp variables?

2014-12-10 Thread shusheng liu
Hello, all. I want to execute an sql with temp variables in sqlalchemy just like in mysql. Here is my sql clause: set @temp=0;select (@temp:= @temp + 1) as ranking, userid from mytable; But sqlalchemy tells This result object does not return rows. Who can tell me if I made some mistakes, or this

Re: [sqlalchemy] Can sqlalchemy set temp variables?

2014-12-10 Thread Michael Bayer
this has to do with the DBAPI allowing it. It’s often possible but you need to do it in such a way that the DBAPI lets it pass through. I’d start by experimenting with a DBAPI cursor, suppose this is pyodbc (I’m not sure that this is, but this seems like SQL server) import pyodbc conn =