Why windows give sqlite3.OperationalError and linux not?

Problem

I have a program that uses storm 0.14 and this gives me this error in windows:

sqlite3.OperationError: database table is locked

The fact is that in linux it works correctly.

I got the impression that this happens only after a certain number of changes are made, as it happens in some code that copies a lot of objects.

Enabling debug mode gives me this in windows:

83 EXECUTE: 'UPDATE regularorder_product SET discount =? WHERE regularorder_product.order_id =? AND regularorder_product.product_id =? ', (Decimal ("25.00"), 788, 274)
84 DONE
85 EXECUTE: 'UPDATE repeated_orders SET nextDate =? WHERE repeated_orders.id =? ', (Datetime.date (2009, 3, 31), 189)
86 ERROR: database table is locked

In linux:

83 EXECUTE: 'UPDATE regularorder_product SET discount =? WHERE regularorder_product.order_id =? AND regularorder_product.product_id =? ', (Decimal ("25.00"), 789, 274)
84 DONE
85 EXECUTE: 'UPDATE repeated_orders SET nextDate =? WHERE repeated_orders.id =? ', (Datetime.date (2009, 3, 31), 189)
86 DONE

System Information

Window

  • Windows XP SP 3
  • Python 2.5.4
  • NTFS partition

Linux

  • Ubuntu 8.10
  • Python 2.5.2
  • ext3 partition

Some code

def createRegularOrderCopy(self):
    newOrder = RegularOrder()
    newOrder.date = self.nextDate
    # the exception is thrown on the next line,
    # while calling self.products.__iter__
    # this happens when this function is invoked the second time
    for product in self.products:
        newOrder.customer = self.customer
        newOrder.products.add(product)
        return newOrder

orders = getRepeatedOrders(date)
week = timedelta(days=7)

for order in orders:
    newOrder = order.createRegularOrderCopy()
    store.add(newOrder)
    order.nextDate = date + week

Question

Is there anything about sqlite3 / python that is different between windows and linux? What could be the cause of this error and how to fix it?

Another observation

When added COMMITto the place where the error occurs, this error occurs instead:sqlite3.OperationalError: cannot commit transaction - SQL statements in progress

Answers to answers

/, concurrency , Store.

+3
5

, sqlite3-dll . , Windows sqlite python windows, Linux.

.

+1

" " SQLite, .

SQL-? SELECT. .

+1

- ? , . , ; .

, , .

+1

, , -, .

Have you tried using sqlite3_busy_timeout()to set the timeout too high? This can lead to SQLite3waiting long enough for the lock holder, whoever it is, to release the lock.

+1
source

Source: https://habr.com/ru/post/1705287/


All Articles