Hi everybody!
I've got a question about threadsafety:
I'm getting objects of type 'dozent' from Zope and insert them into a
PostgreSQL-Database via SQLObject:
db = deputatsabrechnung.DeputatsDB() #getting a connection to the DB (see
code below)
dozenten = self.getDozentListing() #getting the dozenten from zope
for dozent in dozenten:
trans = db.newTransaction() # starting a new transaction
table = db.getDozenten(trans)
table.addDozent(dozent.UID(), dozent.getVorname(),dozent.getName(), dozent.getKuerzel(), dozent.getAnrede())
trans.commit() # ending the transaction
For every dozent i'm inserting into the DB I start a new transaction:
import SQLObject
class DeputatsDB:
def __init__(self):
"""Initiate a database connection"""
self._conn = SQLObject.PostgresConnection('user=akki dbname=deputat')
def newTransaction(self):
"""Open a new transaction"""
return self._conn.transaction()
And now my question: are the insertions into the DB thread-safe?
Regards
Akki Nitsch
#############################################################
The freedom of meaning one thing and saying
something different is not permitted.
E.W. Dijkstra
|