在 Python 3 中使用 SQLite 的 FTS3/4 [英] Using SQLite's FTS3/4 with Python 3

查看:61
本文介绍了在 Python 3 中使用 SQLite 的 FTS3/4的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在使用 python 的 Flask 框架开发 peewee 的示例博客应用程序.(请参阅https://github.com/coleifer/peewee,内部示例>博客).

I have been working on peewee's example blog application using python's Flask framework. (See https://github.com/coleifer/peewee, inside examples>blog).

我已经安装了所有要求,但是当我尝试运行该应用程序时,我不断收到

I have installed all the requirements but when I try to run the application I keep getting

no such module : FTS4

错误.

你认为我为什么会收到这个错误?这是否意味着标准的 Python3 sqlite3 模块没有 FTS 模块?

Why do you think I get this error? Does this mean the standard Python3 sqlite3 module doesn't have FTS modules?

如果是这样,有没有办法为 Python 3.4 启用(安装)FTS3/FTS4 模块?

If so is there a way to enable (install) FTS3/FTS4 modules for Python 3.4?

推荐答案

您可以打开一个 sqlite shell 并运行 pragma compile_options 来查看您的 SQLite 有什么.AFAIK 这与 Python3 无关.

You can open a sqlite shell and run pragma compile_options to see what your SQLite has. AFAIK this has nothing to do with Python3.

这是我的:

sqlite> pragma compile_options;
ENABLE_COLUMN_METADATA
ENABLE_FTS3
ENABLE_RTREE
ENABLE_UNLOCK_NOTIFY
SECURE_DELETE
SYSTEM_MALLOC
THREADSAFE=1

如果您发现没有 FTS 扩展,您可能需要重新编译 SQLite.另请查看文档:

You may need to recompile SQLite if you find you do not have the FTS extension. Also check out the docs:

http://sqlite.org/fts3.html

这篇关于在 Python 3 中使用 SQLite 的 FTS3/4的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆