A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from http://mail.python.org/pipermail/python-list/2001-April/076131.html below:

getting Gadfly data into a list

getting Gadfly data into a listHarry George hgg9140 at cola.ca.boeing.com
Tue Apr 24 14:30:22 EDT 2001
Does it support "fetchall:?

cursor.execute('select * from MyTable')
rows=cursor.fetchall()
for row in rows:
   #do something to the individual tuple


If so, that generally returns
a list of tuples.

Lee Joramo <lee at joramo.com> writes:

> I have set up a small database using gadfly. Is there a way to directly pull
> query results into a list? Currently the only way that I have found to
> access the data is by using "cursor.pp()". But this displays a nicely
> formatted table that is difficult to use for anything.
> 
> For example, I have the following:
> 
> >>>cursor.execute('select * from MyTable')
> >>>print cursor.pp()
> 
> MY_INTEGER | MY_FLOAT | MY_STRING
> ==================================
> 1          | 3.13     | abc
> 2          | 5.23425  | 345
> 3          | 10.23423 | green frog
> 
> I would like to do something like:
> 
> >>>a = cursor.LIST_RESULTS()
> >>>print a
> [[1, 3.13, 'abc'], [2, 5.23425, "abc"], [3, 10.23423, "green frog"]]
> 
> 
> TIA,
> 
> Lee Joramo
> lee.list at joramo.com
> 

-- 
Harry George                E-mail:  harry.g.george at boeing.com
The Boeing Company          Renton:  (425) 237-6915
P. O. Box 3707  02-CA       Everett: (425) 266-3868
Seattle, WA 98124-2207      Page:    (425) 631-8803  

More information about the Python-list mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4