Friday, December 7, 2012

apsw + cifs (samba) on ubuntu

Problem: a python program using apsw on MacOSX runs fine and fast using c.executemany to do inserts. When the same program is run on Ubuntu 12 the program runs very slow.

Solution:  Use transactions explicitly. Use a 'BEGIN' and 'END' statements to bracket the list of inserts. For some reason on Mac OS X this does not make a difference, but in Ubuntu it does

Problem: On Ubuntu a python program using apsw can create a database just fine on a local drive but on a samba (smb) network drive it gives the error: apsw.BusyError: BusyError: database is locked

Solution: use the nobrl option to mount. eg. in the /etc/fstab the line should look like

//server/path   /mnt/LabServer cifs nobrl,credentials=/my/home/credfile,iocharset=utf8,file,uid=1000,gid=1000

No comments:

Post a Comment