code: def _prepare_insert(self, tmpl, record_class, field_names, placeholder_for_id=False):
          
          field_names = list(field_names)
          if hasattr(record_class, 'application_name') and 'application_name' not in field_names:
              field_names.append('application_name')
          if hasattr(record_class, 'pipeline_id') and 'pipeline_id' not in field_names:
              field_names.append('pipeline_id')
          if hasattr(record_class, 'causal_dependencies') and 'causal_dependencies' not in field_names:
              field_names.append('causal_dependencies')
          if placeholder_for_id:
              if self.notification_id_name:
                  if self.notification_id_name not in field_names:
                      field_names.append('id')
  
          statement = tmpl.format(
              tablename=self.get_record_table_name(record_class),
              columns=", ".join(field_names),
              placeholders=", ".join(['%s' for _ in field_names]),
              notification_id=self.notification_id_name
          )
          return statement
docs: With transaction isolation level of "read committed" this should
          generate records with a contiguous sequence of integer IDs, using
          an indexed ID column, the database-side SQL max function, the
          insert-select-from form, and optimistic concurrency control.