python and sqlite3, check if I can use fts5 extension?

前端 未结 1 1683
走了就别回头了
走了就别回头了 2021-01-20 07:59

I recently found out that FTS5 extension has been released.
What is the best way to check if my application can use it on users system?
Just python3 version check, o

相关标签:
1条回答
  • 2021-01-20 08:35

    / this was previously edit of the OP post, but I moved it down here to keep the question clear

    so this feels like it could work, found it in the question here

    import sqlite3
    
    con = sqlite3.connect(':memory:')
    cur = con.cursor()
    cur.execute('pragma compile_options;')
    available_pragmas = cur.fetchall()
    con.close()
    
    print(available_pragmas)
    
    if ('ENABLE_FTS5',) in available_pragmas:
        print('YES')
    else:
        print('NO')
    

    But what is strange is that I run it in a few virtual machines, and none had fts4 enabled, yet I used it happily like nothing... maybe its fts3/fts4 being rather the same, or maybe its just all wrong.

    /edit
    from the documentation

    Note that enabling FTS3 also makes FTS4 available. There is not a separate SQLITE_ENABLE_FTS4 compile-time option. A build of SQLite either supports both FTS3 and FTS4 or it supports neither.

    0 讨论(0)
提交回复
热议问题