I\'m writing a program that creates a sqlite3 database through python. I have one table of Authors (AuthorID, Name) and a second table of books (BookID, Title, AuthorID) I\'ve c
The PRAGMA foreign_keys setting applies to a connection, so you should execute it immediately after calling sqlite3.connect().
PRAGMA foreign_keys
sqlite3.connect()
Please note that foreign key constraints work only inside the same database; you should put both tables into the same file.