PyGres????

Samuel A. Falvo II kc5tja at garnet.armored.net
Mon Aug 7 18:55:25 EDT 2000


I've managed to get ahold of PyGres, a module that allows Python
applications to access Postgre databases.  However, there isn't a *word* of
documentation *anywhere* on how to use this thing, not with it, nor on the
Internet, based on my Google and python.org searches.

I'm having two issues.  First, I can't seem to connect to a database without
typing the name of the database *precisely*.  That is, it's not case
insensitive.  For example, basics.DB("testDB") might work, while
basics.DB("testdb") will likely NOT work.  A minor issue, and one which I
can work around.  But it really is very annoying.

Second, and far more important, is how the heck do I access individual
records piecemeal?  In other words, suppose I have:

	>>> import basics	# from /usr/share/doc/python-pygres/tutorial
	>>> db = basics.DB("testDB")
	>>> db.query("Select * from weather;");

the db.query() function call above will return a *string* containing the
PostgreSQL table information.  This formatting is thoroughly unacceptable
for my needs.  Is there any way to get that DB object return something more
suitable for automated processing, such as a list of lists:

		ColumnA | ColumnB
		--------+--------
		  45    |   90
		 22.5   |   50
 
would be returned as:

	[[45,22.5],[90,50]]

or something of this nature?  I can sure use any advice you folks have to
offer.  :-)

Thanks in advance!

-- 
KC5TJA/6, DM13, QRP-L #1447 | Official Channel Saint, *Team Amiga*
Samuel A. Falvo II	    |
Oceanside, CA		    |



More information about the Python-list mailing list