title: Trying to populate database from Python - AttributeError: 'tuple' object has no attribute 'keys'
body: <p>Basically I'm scraping data off a leaderboard (<code>NYT crossword</code>) and trying to put it into a <strong>database</strong>. I realize a database is overkill for this but I'm trying to teach myself how to use <code>Postgres</code> via <code>SQLAlchemy</code>.</p>
  <p>I'm able to <strong>CREATE TABLE</strong>, so I know I'm connected and the db connection is good.</p>
  <p>Using <code>bs4</code>, I do a for loop and find each players name and time. But when I go to add those times to the db, I get :</p>
  <blockquote>
  <p>&quot;AttributeError: 'tuple' object has no attribute 'keys'&quot;</p>
  </blockquote>
  <p>Here's the relevant part of the code:</p>
  <pre><code>db.execute(&quot;&quot;&quot;CREATE TABLE IF NOT EXISTS solves (
          id SERIAL PRIMARY KEY,
          name VARCHAR NOT NULL,
          time INTEGER,
          date DATE NOT NULL DEFAULT CURRENT_DATE);&quot;&quot;&quot;)
      db.commit()
      for solver in solvers:
          name = solver.find('p', class_='lbd-score__name').text.strip()
          try:
              time = solver.find('p', class_='lbd-score__time').text.strip()
          except:
              time=&quot;--&quot;
          if name.endswith(&quot;(you)&quot;):
              name_split = name.split()
              name = name_split[0]
          if name in players:
              daytimes.append([month,day,year,name,time])
              db.execute(&quot;INSERT INTO solves (name, time) VALUES (?, ?)&quot;, (name, time))
              db.commit()
  </code></pre>
  <p>I've tried a number of things, but generally get the same result (though sometimes it says <code>&quot;AttributeError: 'list' object has no attribute 'keys'&quot;</code> (instead of tuple). I've tried using <code>%s</code> instead of <code>?</code>, tried setting it up like this:</p>
  <pre><code>        entry = (name,time)
          sql = &quot;&quot;&quot;
              INSERT INTO solves (name,time) 
              VALUES (%s,%s)&quot;&quot;&quot;
          db.execute(sql, entry)
          db.commit()
  </code></pre>
  <p>But I keep getting that <code>AttributeError</code>.</p>
  <p>The only way I can get it to work is if I do it this way:</p>
  <pre><code>db.execute(&quot;INSERT INTO solves (name, time) VALUES ('kyle', '45')&quot;)
  </code></pre>
  <p>But then obviously I'm not using the values I'm scraping.</p>
  <p>Any help would be appreciated - thanks!</p>