On 9/11/07, David Bingerwrote: > > On Sep 11, 2007, at 11:29 AM, Mike Orr wrote: > > > On the other hand, it's easier to do a SQL query > > or bulk update in one step than to loop through all your records in a > > 'for' statement, plus you can do queries directly in the command-line > > tool. > > I'm curious about how writing a query is easier than writing a loop. > It doesn't seem better to me. It's just sometimes a hassle to write a loop to count records matching a condition, or to perform a common update on several records. You can avoid the loop with a clever list interpolation or itertools functions. The equivalent SQL or SQLAlchemy construct is sometimes a shorter one-liner. It doesn't matter in programs, just in interactive usage. -- Mike Orr