Re: Python and 8.0 beta

From: Clodoaldo Pinto Neto <clodoaldo_pinto(at)yahoo(dot)com(dot)br>
To: Tim Penhey <tim(at)penhey(dot)net>, pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: Re: Python and 8.0 beta
Date: 2004-08-22 20:33:20
Message-ID: 20040822203320.29464.qmail@web40912.mail.yahoo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

> Are there any python drivers that work with the version 8 beta?
>
> The version seven ones didn't.

This script is working with version 7.4.2, FC2, python 2.3.3

#! /usr/bin/env python
import pgdb
db = pgdb.connect(dsn="localhost:ksDesenv")
cursor = db.cursor()
cursor.execute("select * from times()")
rsTimes = cursor.fetchall()
for lTime in rsTimes:
i = 0
# print str(lTime[0])
cursor.execute("select * from usuarios_do_time(" + str(lTime[0]) +
")")
rsMembros = cursor.fetchall()
for lMembro in rsMembros:
f = open('/var/www/html/kakaostats/u' + str(lMembro[0]) + '.txt',
'w')
f.write(repr(lMembro[1]) + ';' + str(lMembro[2]) + ';' + lMembro[5] +
'\n')
i += 1
# print i, lTime[0], lMembro
rank = lMembro[4]
cursor.execute("select * from concorrentes_de_um_usuario(" +
str(lTime[0]) + "," + str(lMembro[2]) + "," + str(lMembro[3]) + "," +
str(rank) + ")")
rsConcorrentes = cursor.fetchall()
for lConcorrente in rsConcorrentes:
if lMembro[2] - lMembro[3] > lConcorrente[6] - lConcorrente[7] and
lMembro[4] > lConcorrente[4]:
rank -= 1
rg = 'g'
else:
rank += 1
rg = 'r'
f.write(str(rank) + ";")
for campo in lConcorrente:
f.write(repr(campo) + ';')
f.write(rg + '\n')
# print rank, lConcorrente, rg
f.close()
# print raw_input(":")
cursor.close()
db.close()

Regards,
Clodoaldo Pinto




_______________________________________________________
Yahoo! Acesso Grátis - navegue de graça com conexão de qualidade!
http://br.acesso.yahoo.com/

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Bruce Momjian 2004-08-22 20:43:24 Re: Unsupported 3rd-party solutions (Was: Few questions on
Previous Message Peter Eisentraut 2004-08-22 19:48:03 Re: Python and 8.0 beta