Search code examples
pythonsqlite

Why do I get "Incorrect number of bindings supplied" without using bindings?


My code:

@classmethod
def next_page(cls):
    cls.cur.execute("SELECT * FROM Posts WHERE Id < 10 ORDER BY Date DESC Limit 10")
    rows = cls.cur.fetchall()

    return rows

I get the following error:

Traceback (most recent call last):
    File "<stdin>", line 1, in <module>
    File "database.py", line 20, in next_page
        rows = cls.cur.fetchall()
sqlite3.ProgrammingError: Incorrect number of bindings supplied. The current statement uses 1, and there are 2 supplied

What is the deal with this?


Solution

  • Turns out(since I was running the code in the REPL) that you have to CTRL+C and enter the REPL again when you modify a file.