In a special case (described below) when trying to update a sqlite3 database file located in a directory I have no write permissions to, I obtain quite a misleading error message:
unable to open database file "insert into ......."
I.e. it looks like Sqlalchemy thinks the SQL is in fact a path to the database.
How to replicate
(tested on Linux OS)
Manually (i.e. not using a Python code) create a sqlite3 database, e.g. /home/you/data/test.db with some table in it:
CREATE TABLE cache (key text primary key, value text);
Remove your write permissions from the data directory (i.e. not the file itself!).
Run the following code:
from sqlalchemy import create_engine en = create_engine('sqlite:////home/you/data/test.db') en.execute("INSERT INTO cache (key, value) VALUES ('foo', 'bar')")