How to fix " sqlite3.OperationalError: incomplete input " when the error is regarding ''')

Viewed 37695

This is the error I am getting:

Traceback (most recent call last): File "/Users/My Documents/Independent Learning/BBA Coding Related Work/Creating a Database with SQLite3 for Python/MarketCo1.py", line 89, in '''); sqlite3.OperationalError: incomplete input

Below is the code I used:

cursor.execute('''CREATE TABLE ContactEmployee(
   ContactEmployeeID INTEGER PRIMARY KEY, 
   ContactID INTEGER, EmployeeID INTEGER, 
   ContactDate NUMERIC, 
   Description TEXT,  
   FOREIGN KEY(ContactID) REFERENCES Contact(ContactID), 
   FOREIGN KEY(EmployeeID) REFERENCES Employee(EmployeeID)
   ''')
db.commit()
1 Answers

You are missing a closing brace, as mentioned by glibdud in the comments:

cursor.execute('''CREATE TABLE ContactEmployee(
  ContactEmployeeID INTEGER PRIMARY KEY, 
  ContactID INTEGER, EmployeeID INTEGER, 
  ContactDate NUMERIC, 
  Description TEXT,  
  FOREIGN KEY(ContactID) REFERENCES Contact(ContactID), 
  FOREIGN KEY(EmployeeID) REFERENCES Employee(EmployeeID))
  ''')
db.commit()
Related