I am trying to make a connection to my (pysqlcipher) encrypted sqlite database but I am failing because PRAGMA key input is incorrect. I have my correct password 'test' in a separate .env file.

Even though everything should be correct I get the following ERROR message: Error while connecting to sqlite. Incorrect number of bindings supplied. The current statement uses 0, and there are 1 supplied.

How can I solve this? I think it is syntax error.

.env file

DATABASE_SECRET_KEY = test

PYTHON SCRIPT

import sqlite3
import os
from flask import Flask, render_template, jsonify, request, flash, redirect, url_for, session
from pysqlcipher3 import dbapi2 as sqlite3

sqliteConnection = sqlite3.connect('./database/test.db')
cursor = sqliteConnection.cursor()

PRAGMA_key = os.environ.get("DATABASE_SECRET_KEY")
cursor.execute("PRAGMA key = \'%s\';", [PRAGMA_key])

print("Successfully Connected to SQLite")

ERROR

Error while connecting to sqlite.

Incorrect number of bindings supplied. The current statement uses 0, and there are 1 supplied.
0

There are 0 answers