title: how to set date value or null in sql formatted query string for a date column
body: <p>I have a task to copy data from one db table to another db table using psycopg2 library in python language.</p>
  
  <p>Now after fetching a row from first db I have to insert the row into the second db table, but the problem I face is that I need to format the query and insert the value for date column from a variable which may or may not have a date value, so my query is like the following:</p>
  
  <pre><code>cur.execute("""update table_name set column1 = '%s', column2 = '%s',column_date = '%s'""" % (value1, value2, value_date))
  </code></pre>
  
  <p>will now the <code>value_date</code> may be a <code>date</code> or a <code>None</code> value, so how to I convert this <code>None</code> value to sql <code>null</code> or something so that it can be stored in the date column.</p>
  
  <p>Note: considering the <code>value1</code>, <code>value2</code> and <code>value_date</code> are variables containing values.</p>