title: How to specify postgres table columns as variables in python?
body: <p>So I have a table that is being updated with new columns every time a new instance of a class is being instantiated. Here's my code doing that.</p>
  
  <pre><code>query = "alter table test add column %s integer"
  rows = (str(Driver.count), str(Driver.count+1))
  for c in rows:
      cur.execute(query, (AsIs(c),))
  conn.commit()
  </code></pre>
  
  <p>Driver.count is the counter that is being incremented every new instance of the class. Now when I want to update the table, I use a command similar to this:</p>
  
  <pre><code>cur.execute("INSERT INTO test (str(Driver.count), str(Driver.count+1)) \
  VALUES (%d, %d)" % (currentRow,currentCol));
  </code></pre>
  
  <p>Where the two columns I am specifying are variables. I know the above command won't work, since the column variables somehow need to be outside of the quotations, like when I specify the values to be inserted. How can I do this?</p>