title: Foreign Key Constraint Failed in Sqlite3
body: <p>I'm executing this script for the second time(these tables exist previously) and am getting a Foreign Key Constraint Failed error. I'm a beginner in Sqlite3 and am not able to figure out the cause behind it. </p>
  
  <p>Schema.sql </p>
  
  <pre><code>PRAGMA foreign_keys = 1;
  
  drop table if exists user;
  create table user(uid integer primary key autoincrement, 
  username text not null,
  password text not null,
  email text not null,
  isadmin integer default 0);
  
  drop table if exists asset;
  create table asset(aid integer primary key autoincrement,
  assetname text not null,
  releasedate text,
  owner integer default 0,
  isreserved integer default 0,
  foreign key(owner) references user(uid) on delete set default);
  </code></pre>
  
  <p>I'm reading this file in a Python script.</p>
  
  <p>Error: </p>
  
  <pre><code>Traceback (most recent call last):
    File "&lt;stdin&gt;", line 1, in &lt;module&gt;
    File "main.py", line 37, in create_table
      conn.cursor().executescript(f.read())
  sqlite3.IntegrityError: foreign key constraint failed
  </code></pre>