Hi..
I use the threading module for the fast operation. But i have some
problems..
This is my code sample:
=============== ==
conn =
psycopg2.connec t(user='postgre s',password='po stgres',databas e='postgres')
cursor = conn.cursor()
class paralel(Thread) :
def __init__ (self, veriler, sayii):
Thread.__init__ (self)
def run(self):
save(a, b, c)
def save(a,b,c):
cursor.execute( "INSERT INTO keywords (keyword) VALUES
('%s')" % a)
conn.commit()
cursor.execute( "SELECT
CURRVAL('keywor ds_keyword_id_s eq')")
idd=cursor.fetc hall()
return idd[0][0]
def start(hiz):
datas=[........]
for a in datas:
current = paralel(a, sayii)
current.start()
=============== ===
And it gives me different errors to try parallel insert. My querys
work in normal operation but in paralel don't work.
How can i insert data to postgresql the same moment ?
errors:
no results to fetch
cursor already closed
I use the threading module for the fast operation. But i have some
problems..
This is my code sample:
=============== ==
conn =
psycopg2.connec t(user='postgre s',password='po stgres',databas e='postgres')
cursor = conn.cursor()
class paralel(Thread) :
def __init__ (self, veriler, sayii):
Thread.__init__ (self)
def run(self):
save(a, b, c)
def save(a,b,c):
cursor.execute( "INSERT INTO keywords (keyword) VALUES
('%s')" % a)
conn.commit()
cursor.execute( "SELECT
CURRVAL('keywor ds_keyword_id_s eq')")
idd=cursor.fetc hall()
return idd[0][0]
def start(hiz):
datas=[........]
for a in datas:
current = paralel(a, sayii)
current.start()
=============== ===
And it gives me different errors to try parallel insert. My querys
work in normal operation but in paralel don't work.
How can i insert data to postgresql the same moment ?
errors:
no results to fetch
cursor already closed
Comment