title: SQLite Errors and Exits (after first result) when running IF statement inside FOR loop
body: <p>I built a scrapy spider to run through a job site and return all jobs I'm qualified for so I don't have to scroll through them every day.</p>
  
  <p>I'm parsing the json correctly:</p>
  
  <pre><code>        jsonresponse = json.loads(response.body)
          for item in jsonresponse:
              yield{
                  'id':item['id'],
                  'date':item['date'],
                  'company':item['company'],
                  'position':item['position'],
                  'description':item['description'],
                  'url':item['url'],
                  }
  </code></pre>
  
  <p>And I set up a function to take whatever .csv file I save the results as, create a new one as a backup, then create a SQLite db to dump results into:</p>
  
  <pre><code>    def close(self, reason):
          csv_file = max(glob.iglob('*.csv'), key=os.path.getctime)
  
          with open(csv_file) as input, open('jobs2.csv', 'w', newline='') as output:
              writer = csv.writer(output)
              for row in csv.reader(input):
                  if any(field.strip() for field in row):
                      writer.writerow(row)
  
  
          db = sqlite3.connect(':memory:')
          csv_data = csv.DictReader(open('jobs.csv'))
          cur = db.cursor()
          cur.execute('''CREATE TABLE jobs_table(date TEXT PRIMARY KEY,
                                                 id TEXT,
                                                 company TEXT, 
                                                 position TEXT,
                                                 description TEXT,
                                                 url TEXT)
                      ''')
  
  
          db.commit()
          print('')
          print('DB CREATED')
          print('')
  </code></pre>
  
  <p>Then, I'm defining a list of "skills" to check against each row in the .csv file to see if I'm qualified for the position:</p>
  
  <pre><code>    # skills = {'python'}
      skills = ('python')
  
      for row in csv_data:
          if skills in row.get('description').lower():
              print('Job Match!')
              print('')
              print('')
              print(row)
              print('')
              print('')```
  </code></pre>
  
  <p>And this is where I run into issues. It prints that there is a Match, and it prints the OrderedDict for the FIRST result: </p>
  
  <pre><code>2019-06-18 14:59:56 [scrapy.extensions.feedexport] INFO: Stored csv feed (309 items) in: jobs.csv```
  
  
  DB CREATED
  
  
  Job Match!
  
  
  OrderedDict([('id', '73345'), ('date', '2019-06-11T14:16:33-07:00'), ('company', 'JBS Custom Software Solutions'), ('position', 'Full Stack Developer'), ('description', 'JBS Full-Stack Developer (Python, JavaScript, PostgreSQL)Required; 3+ years working with Python&amp;nbsp;&amp;nbsp;&amp;nbsp; 3+ years working with JavaScript; Strong knowledge of modern JavaScript development practices; Strong computer science skills'), ('url', 'https://entrenous.com/jobs/73472')])```
  </code></pre>
  
  <p>Then, problems occur when I try to run cur.execute() to INSERT rows INTO my "jobs_table". Here's what I've tried (COMMANDS) and what it's kicked back (ERROR):</p>
  
  <p>COMMAND:
  <code>cur.execute('INSERT INTO jobs_table(date, id, company, position, description, url) VALUES(%s, %s, %s, %s, %s, %s)', row)</code></p>
  
  <p>ERROR:
  <code>(sqlite3.OperationalError: near "%": syntax error)</code></p>
  
  <p>COMMAND:
  <code>cur.execute('INSERT INTO jobs_table(date, id, company, position, description, url) VALUES(?, ?, ?, ?, ?, ?)', row)</code></p>
  
  <p>ERROR: 
  <code>(sqlite3.ProgrammingError: Binding 1 has no name, but you supplied a dictionary (which has only names).)</code></p>
  
  <p>COMMAND:
  <code>cur.execute("INSERT INTO jobs_table(date, id, company, position, description, url) VALUES(date, id, company, position, description, url)", row)</code></p>
  
  <p>ERROR: 
  <code>(sqlite3.OperationalError: no such column: date)</code></p>
  
  <p>COMMAND:
  <code>cur.execute("INSERT INTO jobs_table(date, id, company, position, description, url) VALUES(:date, :id, :company, :position, :description, :url)", row)</code></p>
  
  <p>ERROR: 
  <code>(sqlite3.IntegrityError: UNIQUE constraint failed: jobs_table.date)</code></p>
  
  <p>COMMAND:
  <code>cur.execute("INSERT INTO jobs_table(date, id, company, position, description, url) VALUES('date', 'id', 'company', 'position', 'description', 'url')", row)</code></p>
  
  <p>ERROR: 
  <code>(sqlite3.IntegrityError: UNIQUE constraint failed: jobs_table.date)</code></p>
  
  <p>I'm wrapping it up with a simple commit, close and a print function to let me know everything's fine and I can go back to bed, but as things stand, I can't go back to bed. </p>
  
  <pre><code>        db.commit()
          db.close()
          print("JOBS IMPORTED!")
  </code></pre>
  
  <p>I posted a similar question earlier, but wasn't nearly as clear with what I wanted to gain from posting here, so here's what I want:
  <strong>I want to be able to save only jobs with ["descriptions"] that contain my ["skills"].</strong> 
  The rest of them are useless to me. </p>
  
  <p><strong><em>Is there anyone out there who can help me with this?</em></strong> </p>