Re: Python and 8.0 beta - Mailing list pgsql-general

From Clodoaldo Pinto Neto
Subject Re: Python and 8.0 beta
Date
Msg-id 20040822203320.29464.qmail@web40912.mail.yahoo.com
Whole thread Raw
In response to Python and 8.0 beta  (Tim Penhey <tim@penhey.net>)
Responses Re: Python and 8.0 beta
List 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/

pgsql-general by date:

Previous
From: Christopher Browne
Date:
Subject: Re: Unsupported 3rd-party solutions (Was: Few questions on postgresql
Next
From: Bruce Momjian
Date:
Subject: Re: Unsupported 3rd-party solutions (Was: Few questions on