Incompatibility with latest libsqlite 3.49.1
I'm seeing an exception when running diskcache with libsqlite 3.49.1. I don't see the same exception with libsqlite 3.48.0.
lib\site-packages\diskcache\core.py:808: in set
self._row_insert(db_key, raw, now, columns)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <diskcache.core.Cache object at 0x0000022E9CCC7E20>
key = '77c445cc8460f4f934c43483991ba5c297eb27fa6efe00f01da92a3b85ae5642', raw = True, now = 1740589097.66946
columns = (None, None, 0, 1, None, 'ab0169c71b0f496aadd6f647d989a7e4')
def _row_insert(self, key, raw, now, columns):
sql = self._sql
expire_time, tag, size, mode, filename, value = columns
> sql(
'INSERT INTO Cache('
' key, raw, store_time, expire_time, access_time,'
' access_count, tag, size, mode, filename, value'
') VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)',
(
key,
raw,
now, # store_time
expire_time,
now, # access_time
0, # access_count
tag,
size,
mode,
filename,
value,
),
)
E sqlite3.OperationalError: no such column: "size" - should this be a string literal in single-quotes?
lib\site-packages\diskcache\core.py:857: OperationalError
So far I've only tested on Windows (specifically using conda to build the environment and switch the version of libsqlite), and the exception came from deep in one of my own code's tests. So if it's not obvious what's going on then I can try for a minimal reproducing case, but my suspicion is that anything that calls that line of code in diskcache will trigger it.
I don't know whether or not this is intentional and/or reasonable behaviour by libsqlite. They do say that all English words could become SQL keywords at any time, and so "to prevent your code from being broken by future enhancements, you should normally quote any identifier that is an English language word, even if you do not have to". But I doubt that anyone actually does that. Anyway 'size' isn't even on the current documented list (last modified in 2022): https://sqlite.org/lang_keywords.html and isn't mentioned in their release notes as a new keyword: https://sqlite.org/releaselog/3_49_1.html
I'm having this problem as well. Looks like this is a known issue that would be fixed by #311. We're seeing it now because conda-forge changed how they build sqlite: https://github.com/conda-forge/sqlite-feedstock/issues/130. I am pinning libsqlite<3.49.0 for now.
There is a PR patching diskcache only on conda-forge that would make diskcache compatible with conda-forge's build of libsqlite, but only when diskcache is installed via conda-forge: https://github.com/conda-forge/diskcache-feedstock/pull/35