OperationalError no such table in Flask with SQLAlchemy

For anyone trying to use an in memory database:

from sqlalchemy import create_engine
from sqlalchemy.pool import StaticPool

engine = create_engine(
    "sqlite://", 
    connect_args={"check_same_thread": False}, 
    poolclass=StaticPool
)

There were few things I had to change to make everything work.

  1. replace DATABASE_URI with SQLALCHEMY_DATABASE_URI parametr in config
  2. replace :memory: sqlite address with /tmp/test.db

Now it works fine.