79571156

Date: 2025-04-13 02:54:51
Score: 1
Natty:
Report link

Turns out you're not supposed to add

'sqlite:///'

in front of the path, and instead, the full path. This is because 'sqlite:///' is used for SQLAlchemy connections

Here is what I changed in my code at the top:

import sqlite
import os

def connect_db():
    db_path = os.path.join(current_app.instance_path, 'app.db')
    print(f"path: {db_path}")
    conn = sqlite3.connect(db_path)
    conn.row_factory = sqlite3.Row
    return conn
Reasons:
  • Has code block (-0.5):
  • Self-answer (0.5):
  • Low reputation (1):
Posted by: Lifeable