Skip to main content
correction
Source Link
DinoCoderSaurus
  • 28.6k
  • 2
  • 12
  • 31

sqlite3 on cs50 does have foreign key capabilities. If you want to enforce foreign key constraints in phpLiteAdmin (or sqlite3), the command is simply PRAGMA foreign_keys = ON;. You would only use db.execute("PRAGMA foreign_keys = ON"); in python (execute is a method of a SQL object). Foreign key support must be turned "on" for every database connection, so the db.execute would probably go right after db is instantiated in application.py.

sqlite3 on cs50 does have foreign key capabilities. If you want to enforce foreign key constraints in phpLiteAdmin (or sqlite3), the command is simply PRAGMA foreign_keys ON;. You would only use db.execute("PRAGMA foreign_keys = ON"); in python (execute is a method of a SQL object). Foreign key support must be turned "on" for every database connection, so the db.execute would probably go right after db is instantiated in application.py.

sqlite3 on cs50 does have foreign key capabilities. If you want to enforce foreign key constraints in phpLiteAdmin (or sqlite3), the command is simply PRAGMA foreign_keys = ON;. You would only use db.execute("PRAGMA foreign_keys = ON"); in python (execute is a method of a SQL object). Foreign key support must be turned "on" for every database connection, so the db.execute would probably go right after db is instantiated in application.py.

Source Link
DinoCoderSaurus
  • 28.6k
  • 2
  • 12
  • 31

sqlite3 on cs50 does have foreign key capabilities. If you want to enforce foreign key constraints in phpLiteAdmin (or sqlite3), the command is simply PRAGMA foreign_keys ON;. You would only use db.execute("PRAGMA foreign_keys = ON"); in python (execute is a method of a SQL object). Foreign key support must be turned "on" for every database connection, so the db.execute would probably go right after db is instantiated in application.py.