title: Postgres ON CONFLICT DO UPDATE only non null values in python
body: <p>I have a table for which when processing records I get either the full record, else only the columns to be updated. </p>
  
  <p>I want to write a query to handle updates but only update the columns with non null values. For example,</p>
  
  <p>Existing table:</p>
  
  <pre><code>1 | John Doe | USA
  2 | Jane Doe | UK
  </code></pre>
  
  <p>Incoming records:</p>
  
  <pre><code>(3, Kate Bill, Canada)
  (2, null, USA)
  </code></pre>
  
  <p>I want to insert the first record and on conflict of key on second record ONLY update the last column. </p>
  
  <p>I'm not sure how to write this using a execute_values method call:</p>
  
  <pre><code>execute_values(cursor, "INSERT INTO user_data\
             (id, name, country) VALUES %s ON CONFLICT DO UPDATE SET \
              &lt;how to only set non null values here&gt;", vendor_records)
  </code></pre>
  
  <p>I'm using psycopg2 to execute this.</p>