M
M
mad_god2015-11-24 17:11:37
Python
mad_god, 2015-11-24 17:11:37

Why do several Python processes lose information when writing to a SQLite database?

Information that is processed by one process is completely written to the database,
unlike information that is processed by four processes. Error trapping is enabled, but there are no messages, meanwhile, the base in the second case is less, one and a half times.
Recordings to the database do not occur simultaneously, even included in the script the opening and closing of the database when writing, as well as waiting if the database is busy.
Before moving on to postgresql, I would like to understand this
piece of code:

db = sqlite3.connect('data/mydb08')
  print "db=",db
  cursor = db.cursor()
  flag3=True
  while (flag3):
    try:
      cursor.executemany("INSERT INTO articles(link,alink,time, author,comment,rating) VALUES(?,?,?,?,?,?)",lst)
      flag3=False
    except sqlite3.Error, err:
      print "Error %s:" % err.args[0]
  
  d=db.commit()
  print "d=",d
  db.close()

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question