mercredi 4 novembre 2015

Python SQLAlchemy SQLite FTS unicode6.1 tokenizer

This is the code to attempt SQLAlchemy database reflection on a SQLite3 database with FTS tables that use a unicode61 tokenizer:

from sqlalchemy import create_engine
from sqlalchemy.ext.declarative import declarative_base

engine = create_engine('sqlite:///database.sqlite')
Base = declarative_base()
metadata = Base.metadata
metadata.reflect(bind=engine, views=True)

This error:

sqlalchemy.exc.OperationalError: (sqlite3.OperationalError) unknown tokenizer: unicode61

As of v3.8.6 this tokenizer is included by default and is not optionally compiled.

v3.6.3 The unicode61 tokenizer is now included in FTS4 by default.

Meanwhile when I run:

$ python
>>> import sqlite3
>>> sqite3.sqlite_version
'3.8.5'

... frick.

However:

$ sqlite3
SQLite version 3.9.2 2015-11-02 18:31:45

How do I get Python or SQLAlchemy in particular to reference a more modern or even custom compiled sqlite3 binary?

Aucun commentaire:

Enregistrer un commentaire