Question: I keep getting a cur.execute ( classes _ table ) sqlite 3 . OperationalError: incomplete input my student table works when i run it
I keep getting a cur.executeclassestable
sqliteOperationalError: incomplete input"
my student table works when i run it without the classes table so i dont know what is wrong. pretty new to all this
import sqlite as sql
DatabaseContent
id:
"currentlyEnrolled": False,
"age":
"firstName": "Veronica",
"lastName": "Potter",
"gender": "female",
"email": "veronicapotter@furnigeer.com",
"phone":
"address": Downing Street, Tyro, Nebraska,
"registered": "Wed Feb ::
'classes':
id:
"currentlyEnrolled": True,
"age":
"firstName": "Bray",
"lastName": "Summers",
"gender": "male",
"email": "braysummers@furnigeer.com",
"phone":
"address": Dekoven Court, Driftwood, Marshall Islands,
"registered": "Mon Aug ::
"classes":
Classes
id:
"code": "INFO
"title": "Basic Programming",
"description": "Basic programming class using Python."
id:
"code": "INFO
"title": "Intro to Programming",
"description": "Visual programming class"
id:
"code": "INFO
"title": "Intro to Web Development",
"description": "Basics of HTML and CSS
conn sqlconnectmaindb
cur conn.cursor
studenttable CREATE TABLE IF NOT EXISTS students id INTEGER not null primary key,
currentlyEnrolled TEXT not null, age INTEGER not null, firstName VARCHAR
lastName VARCHAR gender VARCHAR email VARCHAR phone VARCHAR
address TEXT not null, registered VARCHAR, classes INTEGER
cur.executestudenttable
for x in DatabaseContent:
cur.executeINSERT INTO students id currentlyEnrolled, age, firstName, lastName,
gender, email, phone, address, registered, classes VALUES
xid xcurrentlyEnrolled xage xfirstName xlastName
xgender xemail xphone xaddress xregistered xclasses
classestable CREATE TABLE IF NOT EXISTS classes id INTEGER not null primary key,
'code VARCHAR title VARCHAR description VARCHAR
cur.executeclassestable
for i in Classes:
cur.executeINSERT INTO classes id code, title, description VALUES
iid icode ititle idescription
printcurexecuteSELECT from students'fetchall
printcurexecuteSELECT from classes'fetchall
conn.commit
conn.close
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
