title: SQL - Replace or skip duplicate entries
body: <p>I'm using MySQLConnector for Python to record all of the filepaths in a certain file tree to a SQL table on a regular basis (like on a cronjob or such). What I'm trying to do is write to the table if the filepath is new to the table, else update the table if it finds a pre-existing file path, thus not having duplicate entries. I've experimented with INSERT IGNORE and ON DUPLICATE KEY UPDATE but don't understand how to use it to my needs, since it has been failing me. The bit of code in particular is:</p>
  
  <blockquote>
    <p>insertion = ("INSERT IGNORE INTO storage_folders (folder_path, company) VALUES ('" + filepath + "', '" + company + "')")</p>
  </blockquote>
  
  <p>So I want the table to possess unique folder_paths, with no duplicates. The "company" column does not have to be (and should not) be unique. Can anyone point me to the right path as to how to I do this?</p>