[Twisted-Python] Help about adbapi and sqlreflector
Celso Providelo
cprov at gwyddion.com
Mon Mar 1 09:57:17 MST 2004
Maybe it might be a dummy question, but I couln't solve my doubts with
the set of examples from Twisted about the use of a PostgreSQL DB Server
in the Twisted way.
Will be better if I explain exactly my case:
I have a set of CLIENTS invoking random methods from a SERVER throught
my protocol, one of these should add/update an entry in my DB.
As I can see, if I just add:
conn = PgSQL.connect(database='test');
.....
"""my method !!!!!"""
curs = conn.cursor();
curs.execute(my_query);
conn.commit();
send_reply();
""" just it """
I'll fall in a strong "wasting performance" error; if my DB becomes full
the flows waits here, like in "polling way".
I suspect the solution should be the use of:
from twisted.internet import reactor
from twisted.enterprise import adbapi, row, reflector, sqlreflector
from row_util import *
pool = adbapi.ConnectionPool('pyPgSQL.PgSQL',database='test')
pool.runQuery(my_query);
.... and so on.
But I have no idea about how to recover some results from it or detect
sucess or error (like in row_example.py!!!)
Any help or example will be very apreciated
best regards
--
Celso Providelo
cprov at gwyddion.com
Linux user #166906
Gwyddion - http://www.gwyddion.com
GNUsp Project
LAMI-Laboratories of Microprocessors
Department of Electrical Engineering
University of Sao Paulo (USP - Sao Carlos)
More information about the Twisted-Python
mailing list