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 self.notification_id_name:
              if placeholder_for_id:
                  if self.notification_id_name not in field_names:
                      field_names.append(self.notification_id_name)
  
          statement = text(tmpl.format(
              tablename=self.get_record_table_name(record_class),
              columns=", ".join(field_names),
              placeholders=", ".join([":{}".format(f) for f in field_names]),
              notification_id=self.notification_id_name
          ))
  
          # Define bind parameters with explicit types taken from record column types.
          bindparams = []
          for col_name in field_names:
              column_type = getattr(record_class, col_name).type
              bindparams.append(bindparam(col_name, type_=column_type))
  
          # Redefine statement with explicitly typed bind parameters.
          statement = statement.bindparams(*bindparams)
  
          # Compile the statement with the session dialect.
          compiled = statement.compile(dialect=self.session.bind.dialect)
  
          return compiled
docs: With transaction isolation level of "read committed" this should
          generate records with a contiguous sequence of integer IDs, assumes
          an indexed ID column, the database-side SQL max function, the
          insert-select-from form, and optimistic concurrency control.