How to write a query that uses variables in sqlalchemy? -


i have query works in mysql write using sqlalchemy. simplified version of query looks like:

set @num = null, @val = null; select group_name, count(*) (select @num := if(@last=id, @num+1, 1) num,         @last := id last,         group_name order group_name) num<=100 group group_name; 

my problem setting variables @num , @last , using them in query. know can using execute (something this), prefer use sqlalchemy tools building queries instead of row sql (for maintainance , compatibility reasons). possible?


Comments

Popular posts from this blog

serialization - Convert Any type in scala to Array[Byte] and back -

matplotlib support failed in PyCharm on OSX -

python - Matplotlib: TypeError: 'AxesSubplot' object is not callable -