Better access to database search results

Simon Brunning simon.brunning at gmail.com
Tue Apr 12 11:51:38 EDT 2005


On Apr 12, 2005 4:32 PM, Gabriel Cooper <gabriel.cooper at mediapulse.com> wrote:
> Usually when I access db search results it's something like this:
> 
> cursor.execute("select A1,A2,A3,A4 from B where C")
> for (a1,a2,a3,a4) in cursor.fetchall():
>     stuff()
> 
> But sometimes the point at which I use the data returned is not with the
> search, and so having the ability to access the results as a dictionary
> is more useful.
>
> Let me know what you think. Could this be done simpler?

Have you come across dtuple?
(<http://www.lyra.org/greg/python/dtuple.py>). It's really easy to use
- <http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/81252>.

-- 
Cheers,
Simon B,
simon at brunningonline.net,
http://www.brunningonline.net/simon/blog/



More information about the Python-list mailing list