AnswerDotAI / fastlite

A bit of extra usability for sqlite
https://answerdotai.github.io/fastlite/
Apache License 2.0
147 stars 12 forks source link

How can I use SQLite extensions with fastlite? #27

Open FrLars21 opened 1 week ago

FrLars21 commented 1 week ago

Hi there,

I am using fastlite for my FastHTML app. I am using the sqlite-vec extension installed via its sqlite-utils plugin. When I access the database via sqlite-utils' Database object, I can access the sqlite-vec functionality without any issues. If I access the same database via fastlite's Database object, I get the following error:

sqlite no such module: vec0

Given that fastlite is described as a "thin wrapper around sqlite-utils", I expected the sqlite-vec extension to work seamlessly here as well. Is there a known configuration step I might be missing, or does fastlite handle extensions differently?

I'd appreciate any guidance or suggestions on how to resolve this.

Thanks in advance for your help!

Best regards,
Frederik

asg017 commented 1 week ago

@FrLars21 it's undocumented, but try passing in execute_plugins to the sqlite-utils Database class. Plugins (like sqlite-utils-sqlite-vec) don't automatically enable in the Python API unless execute_plugins=True in the constructor.