home / github / issue_comments

Menu
  • Search all tables
  • GraphQL API

issue_comments: 1098531354

This data as json

html_url issue_url id node_id user created_at updated_at author_association body reactions issue performed_via_github_app
https://github.com/simonw/sqlite-utils/issues/421#issuecomment-1098531354 https://api.github.com/repos/simonw/sqlite-utils/issues/421 1098531354 IC_kwDOCGYnMM5BekIa 9599 2022-04-13T22:08:20Z 2022-04-13T22:08:20Z OWNER

OK I figured out what's going on here. First I added an extra print(sql) statement to the indexes command to see what SQL it was running: ``` (app-root) sqlite-utils indexes global.db --table

select
  sqlite_master.name as "table",
  indexes.name as index_name,
  xinfo.*
from sqlite_master
  join pragma_index_list(sqlite_master.name) indexes
  join pragma_index_xinfo(index_name) xinfo
where
  sqlite_master.type = 'table'
 and xinfo.key = 1

Error: near "(": syntax error This made me suspicious that the SQLite version being used here didn't support joining against the `pragma_index_list(...)` table-valued functions in that way. So I checked the version: (app-root) sqlite3 SQLite version 3.36.0 2021-06-18 18:36:39 ``` That version should be fine - it's the one you compiled in the Dockerfile.

Then I checked the version that sqlite-utils itself was using: (app-root) sqlite-utils memory 'select sqlite_version()' [{"sqlite_version()": "3.7.17"}] It's running SQLite 3.7.17!

So the problem here is that the Python in that Docker image is running a very old version of SQLite.

I tried using the trick in https://til.simonwillison.net/sqlite/ld-preload as a workaround, and it almost worked:

(app-root) python3 -c 'import sqlite3; print(sqlite3.connect(":memory").execute("select sqlite_version()").fetchone())' ('3.7.17',) (app-root) LD_PRELOAD=./build/sqlite-autoconf-3360000/.libs/libsqlite3.so python3 -c 'import sqlite3; print(sqlite3.connect(":memory").execute("select sqlite_version()").fetchone())' ('3.36.0',) But when I try to run sqlite-utils like that I get an error:

(app-root) LD_PRELOAD=./build/sqlite-autoconf-3360000/.libs/libsqlite3.so sqlite-utils indexes /tmp/global.db ... File "/opt/app-root/lib64/python3.8/site-packages/sqlite_utils/cli.py", line 1624, in query db.register_fts4_bm25() File "/opt/app-root/lib64/python3.8/site-packages/sqlite_utils/db.py", line 412, in register_fts4_bm25 self.register_function(rank_bm25, deterministic=True) File "/opt/app-root/lib64/python3.8/site-packages/sqlite_utils/db.py", line 408, in register_function register(fn) File "/opt/app-root/lib64/python3.8/site-packages/sqlite_utils/db.py", line 401, in register self.conn.create_function(name, arity, fn, **kwargs) sqlite3.NotSupportedError: deterministic=True requires SQLite 3.8.3 or higher

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
1180427792  
Powered by Datasette · Queries took 14.569ms · About: github-to-sqlite