I've found some time to investigate this today. Just looking for keywords around the sql statements that were logged meant that I only had to learn enough to understand what a few lines of the pyton code is doing instead of the whole lot.
Anyway, the issue can be fixed by updating line 183, which is currently:
python:
count_files_statement = count_files_statement[:-1] + '))' + count_files_statement[-1:]
to be:
python:
count_files_statement = count_files_statement + ')'
I also found that there's a similar SQL syntax issue when attempting to replace a path in the database, which can be fixed by updating line 1154, currently:
python:
sql = sql.replace('((strPath', '(strPath').replace(' AND ())', ')')
to be:
python:
sql = sql.replace('((strPath', '(strPath').replace(' AND ())', '')
I did attempt to raise pull requests for theses updates, but I don't seem to have access to push to the repo:
git:
$ git push origin no_sources_disabled_sql_fix
remote: Permission to klyco/script.database.cleaner.git denied to sim099.
fatal: unable to access 'https://github.com/klyco/script.database.cleaner.git/': The requested URL returned error: 403