Q1. Good question %) I didn't find anything about it in docs (but i didn't search a lot), so i use map function to convert it to a list you want. And I think it is the right solution. Because if you query for more then one column (session.query(User.is, User.name).all()) a list of tuples is what you want to get as a result. So i think it is good, that it works the same way for one or more then one query params.
On May 26, 9:10 pm, Harish Vishwanath <harish.shas...@gmail.com> wrote: > Hello, > > Question 1: > > When there is a query like below : > > q = session.query(User.name) #(User is a class) > > and when I do q.all(), a list of tuples (User.name,) is returned though a > single column is asked for. Is there a way to get a list directly from > q.all() when a single column is required? > > Question 2: > > I need to delete a bulky table and I want to print diagnostics after n > number of deletes. Is there a way to use Query object so that a SQL > statement like below can be generated? > > " delete from movie where year in (select top 30 year from movie where year > > > 50); ", so that a message can be logged after every 30 deletes. > > I am using Sqlite DB. > > Regards, > Harish --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---