0

I am trying to program a function with an input parameter "date". The function should output all rows with this date from a sqlite table, but I get this error message all the time. Date and the date column in the table are both of type date (YY-MM-DD). when inserting i get no error. does anyone have a solution?

Error message:

File "C:\Users***, line 41, in getTerminbyDate cursor.execute('SELECT * FROM termin WHERE datum=?', date) ValueError: parameters are of unsupported type

Code (main.py):

date = date(2022,4,25)
dbfunction.getTerminbyDate(date)

Code (db.function):

def getTerminbyDate(date):

    connection = sqlite3.connect("planer.db")
    cursor = connection.cursor()

    cursor.execute('SELECT * FROM termin WHERE datum=?', date)
    print(cursor.fetchall())

    connection.commit()

kempi
  • 1
  • The values parameter must be wrapped in a sequence object like a tuple or list. For example `cursor.execute('SELECT * FROM termin WHERE datum=?', (date,))` – snakecharmerb Apr 24 '22 at 07:11

0 Answers0