Skip to content
Advertisement

sqlite3.DatabaseError: malformed database schema (?)

I executed the python file in the first try & it worked. But when I included the code “IF NOT EXISTS” in the line cur.execute("CREATE TABLE IF NOT EXISTS store (item TEXT, quantity INTEGER, price REAL)")& cur.execute("INSERT INTO store VALUES ('Wine Glass,8,10.5')") I am getting an error.

here is my code:

JavaScript

here is the error:

JavaScript

Advertisement

Answer

You have an error in the code:

cur.execute("INSERT INTO store VALUES ('Wine Glass,8,10.5')")

You are providing only single value to three-column table. Replace it with:

cur.execute("INSERT INTO store VALUES ('Wine Glass','8','10.5')")

and your code should work fine.

Advertisement