def extract_values(query):
    d = dict()
    fields = query.model._meta.fields
    for index in range(len(fields)):
        field = fields[index]
        if (field.get_internal_type() == 'AutoField' or
                isinstance(query, subqueries.UpdateQuery) and (getattr(field, 'sf_read_only', 0) & NOT_UPDATEABLE) != 0 or
                isinstance(query, subqueries.InsertQuery) and (getattr(field, 'sf_read_only', 0) & NOT_CREATEABLE) != 0):
            continue
        if(isinstance(query, subqueries.UpdateQuery)):
            # update
            value_or_empty = [value for qfield, model, value in query.values if qfield.name == field.name]
            if value_or_empty:
                [value] = value_or_empty
            else:
                assert len(query.values) < len(fields), \
                        "Match name can miss only with an 'update_fields' argument."
                continue
        else:
            # insert
            # TODO bulk insert
            assert len(query.objs) == 1, "bulk_create is not supported by Salesforce REST API"
            value = getattr(query.objs[0], field.attname)
        # The 'DEFAULT' is a backward compatibility name.
        if isinstance(field, (models.ForeignKey, models.BooleanField, models.DecimalField)):
            if value in ('DEFAULT', 'DEFAULTED_ON_CREATE'):
                continue
        if isinstance(value, models.DefaultedOnCreate):
            continue
        [arg] = process_json_args([value])
        d[field.column] = arg
    #print("postdata : %s" % d)
    return d
Extract values from insert or update query.
dataset/ETHPy150Open django-salesforce/django-salesforce/salesforce/backend/query.py/extract_values