table named excercise
CODB_cursor.execute(""" CREATE TABLE excercise (
distance INTEGER
timeOfRun INTEGER
avgHR INTEGER
dayOfExcercise timestamp
)""")
callOnDB.commit()
function that inserts values to the table named excercise
def insert_excercise(exc):
with callOnDB:
CODB_cursor.execute("INSERT INTO excercise VALUES(:distance,:timeOfRun,:avgHR,:dayOfExcercise)",
{'distance':exc.distance,'timeOfRun':exc.timeOfRun,
'avgHR':exc.avgHR,'dayOfExcercise':exc.dayOfExcercise})
in a different file named excercise there is a class named Excercise with self, distance, timeOfRun, avgHR, dayOfExcercise. exc_1 is passed to insert_excercise function
exc_1 = Excercise(4, 120, 154, datetime.datetime.now())
insert_excercise(exc_1)
i keep on getting :::sqlite3.OperationalError: table excercise has 1 columns but 4 values were supplied:::
i don't know why , i have 4 columns named (distance, timeOfRun, avgHR, dayOfExcercise) i have import sqlite3, import datetime, and from excercise import Excercise (this refers to the other file that has the class excercise)