Zapier MySQL row update not clearing empty values from database records

I’m working with a Zapier automation that syncs data from Airtable to a MySQL database. The workflow has two branches - one creates new records when they don’t exist, and the other updates existing records with fresh data from Airtable.

The update process works perfectly when replacing existing data with new values. For example, this record updates correctly:

+--------+-------------+------------------+
| rec_id | user_notes  | airtable_ref_id  |
+--------+-------------+------------------+
|    234 | good        |  8765432109876   |
+--------+-------------+------------------+

When the user changes the note, it updates to:

+--------+-------------+------------------+
| rec_id | user_notes  | airtable_ref_id  |
+--------+-------------+------------------+
|    234 | excellent   |  8765432109876   |
+--------+-------------+------------------+

However, when a user clears the field completely in Airtable, the MySQL record doesn’t get updated. The old value stays there instead of being cleared.

I need it to look like this when the field is empty:

+--------+-------------+------------------+
| rec_id | user_notes  | airtable_ref_id  |
+--------+-------------+------------------+
|    234 |             |  8765432109876   |
+--------+-------------+------------------+

After testing and talking to Zapier support, it seems the issue is that null values get stripped from the Code step output, so the MySQL update step doesn’t see any change to make.

Here’s my Python code for processing the inputs:

# Handle missing inputs with empty values
def process_field(field_name):
    return source_data.get(field_name, default_value)

def map_all_fields(field_list, mapping_list):
    for source_field, target_field in zip(mapping_list, field_list):
        val = process_field(source_field)
        output_data.update({target_field: val})

source_fields = ['field_machine', 'field_start', 'field_end', 'field_details', 'field_vendor', 'field_scheduled', 'field_approved', 'field_ref', 'field_done', 'field_quote', 'field_invoice', 'field_receipt', 'field_record', 'field_modified', 'field_user_notes']
target_fields = ['machine', 'start', 'end', 'details', 'vendor', 'scheduled', 'approved', 'ref', 'done', 'quote', 'invoice', 'receipt', 'record', 'modified', 'user_notes']

# Process all field mappings
default_value = None
output_data = {}
map_all_fields(target_fields, source_fields)
final_results.update(output_data)

return final_results

The code runs without errors and updates work fine when there’s actual new data, but empty fields don’t clear the old MySQL values. Has anyone found a way to make Zapier MySQL updates handle empty values properly?

Zapier treats null/empty values as unchanged data instead of updates. I hit this same issue syncing inventory data - using a sentinel value works way better than empty strings. In your process_field function, return a special marker like ‘EMPTY’ for missing fields. Then modify your MySQL update query with a CASE statement that converts ‘EMPTY’ to NULL or empty string: UPDATE table SET user_notes = CASE WHEN VALUES(user_notes) = '__EMPTY__' THEN '' ELSE VALUES(user_notes) END. This gives you more control over updates and makes sure Zapier always sees a value to process, even when clearing fields.

zapier automatically strips null values from code step outputs - that’s why your mysql update doesn’t see them. set default_value = ‘’ instead of none, or use a placeholder like ‘CLEAR_FIELD’ and handle it in your update query with a case statement.

Had this exact issue last year syncing CRM data with Zapier. It’s a common problem - Zapier’s MySQL action won’t update fields to empty values because it thinks they’re ‘no change’ instead of ‘clear this field.’ Fixed it by tweaking the Python code to explicitly set empty strings instead of None values. Change your default_value from None to an empty string (‘’) and add a condition that converts any None values to empty strings before returning. So default_value = '' and then before your return statement, loop through output_data and replace any None values with empty strings. This tricks Zapier into seeing there’s actually a value to update with, even though it’s empty. MySQL update should then clear those fields properly.