1) use a common try/except block for all ops
2) do not display query and args when DB is locked (could be several
hundreds rows)
3) re-raise non locking-related exceptions (e.g. a wrong sql statement)
4) split executemany rows into chunks of 500 (so the caller doesn't have
to do it)