title: Import csv into sqlite with autoincrementing primary key
body: <p>I am trying to create a table in sqlite that takes data from a csv file and adds an autoincrementing primary key to the first column.
  Here is the table I am trying to insert data into:</p>
  
  <pre><code>DROP TABLE IF EXISTS Allegiance;
  CREATE TABLE Allegiance (
    AllegianceID INTEGER PRIMARY KEY AUTOINCREMENT,
    CharacterID INTEGER,
    Title TEXT,
    FOREIGN KEY (CharacterID) REFERENCES Characters(CharacterID));
  </code></pre>
  
  <p>Here is the data in the .csv file</p>
  
  <pre><code>, 3, King of the North
  , 14, King of the Andals and the First Men
  , 15, Lord of Dragonstone
  , 26, Khaleesi
  , 35, Lord Reaper of Pyke
  </code></pre>
  
  <p>This is the error I recieve:</p>
  
  <pre><code>sqlite&gt; .mode csv
  sqlite&gt; import allegiances.csv Allegiance;
  Error: datatype mismatch
  </code></pre>
  
  <p>I receive the same error if I have "null" before the first comma in each line.
  When I add random numbers before the first comma in each line, I do not get any errors. However, the actual dataset I need to work with may be much larger and therefore, I can't simply manually add in a unique primary key for each entry. I'd really appreciate some help with this </p>