Add an id to record before create in local
435330
function addIdToSnapshot(snapshot) {
  var record = snapshot.record;
  record.get('store').updateId(record, { id: generateUniqueId() });
  return record._createSnapshot();
}
363093
def create_create():
    
    create = upkey("create").setResultsName("action")
    hash_key = Group(upkey("hash") + upkey("key"))
    range_key = Group(upkey("range") + upkey("key"))

    local_index = Group(
        index
        + Suppress("(")
        + primitive
        + Optional(Suppress(",") + include_vars)
        + Suppress(")")
    )
    index_type = (
        (hash_key | range_key | local_index)
        .setName("index specification")
        .setResultsName("index")
    )

    attr_declaration = (
        Group(var.setResultsName("name") + type_ + Optional(index_type))
        .setName("attr")
        .setResultsName("attr")
    )
    attrs_declaration = (
        Suppress("(")
        + Group(delimitedList(attr_declaration))
        .setName("attrs")
        .setResultsName("attrs")
        + Optional(Suppress(",") + throughput)
        + Suppress(")")
    )

    global_index = _global_index()
    global_indexes = Group(OneOrMore(global_index)).setResultsName("global_indexes")

    return (
        create
        + table_key
        + Optional(if_not_exists)
        + table
        + attrs_declaration
        + Optional(global_indexes)
    )
1257084
def record_id(self, record, type_=None, selector=None):
        """"""
        pk = record_id(record, type_, selector, self.normalize_object_slot)
        return pk
1299426
function (identifier, field, values) {
            var self = this;
            return this.needByIdentifier(identifier).then(function (record) {
                return self.addFieldIfNotExistById(record.id, field, values);
            });
        }
157100
def create(gandi, domain, zone_id, name, type, value, ttl):
    """"""

    if not zone_id:
        result = gandi.domain.info(domain)
        zone_id = result['zone_id']

    if not zone_id:
        gandi.echo('No zone records found, domain %s doesn\'t seems to be '
                   'managed at Gandi.' % domain)
        return

    record = {'type': type, 'name': name, 'value': value}
    if ttl:
        record['ttl'] = ttl

    result = gandi.record.create(zone_id, record)
    return result
628546
def add_record(cls, fqdn, name, type, value, ttl):
        """"""
        data = {
            "rrset_name": name,
            "rrset_type": type,
            "rrset_values": value,
        }
        if ttl:
            data['rrset_ttl'] = int(ttl)
        meta = cls.get_fqdn_info(fqdn)
        url = meta['domain_records_href']
        return cls.json_post(url, data=json.dumps(data))
616685
def insert_recording(hw):
    """"""
    mysql = utils.get_mysql_cfg()
    connection = pymysql.connect(host=mysql['host'],
                                 user=mysql['user'],
                                 passwd=mysql['passwd'],
                                 db=mysql['db'],
                                 charset='utf8mb4',
                                 cursorclass=pymysql.cursors.DictCursor)
    try:
        cursor = connection.cursor()
        sql = ("INSERT INTO `wm_raw_draw_data` ("
               "`user_id`, "
               "`data`, "
               "`md5data`, "
               "`creation_date`, "
               "`device_type`, "
               "`accepted_formula_id`, "
               "`secret`, "
               "`ip`, "
               "`segmentation`, "
               "`internal_id`, "
               "`description` "
               ") VALUES (%s, %s, MD5(data), "
               "%s, %s, %s, %s, %s, %s, %s, %s);")
        data = (hw.user_id,
                hw.raw_data_json,
                getattr(hw, 'creation_date', None),
                getattr(hw, 'device_type', ''),
                getattr(hw, 'formula_id', None),
                getattr(hw, 'secret', ''),
                getattr(hw, 'ip', None),
                str(getattr(hw, 'segmentation', '')),
                getattr(hw, 'internal_id', ''),
                getattr(hw, 'description', ''))
        cursor.execute(sql, data)
        connection.commit()
        for symbol_id, strokes in zip(hw.symbol_stream, hw.segmentation):
            insert_symbol_mapping(cursor.lastrowid,
                                  symbol_id,
                                  hw.user_id,
                                  strokes)
        logging.info("Insert raw data.")
    except pymysql.err.IntegrityError as e:
        print("Error: {} (can probably be ignored)".format(e))
1190481
public function beforeCreate()
    {
        $this->timestamp_create = time();
        $this->timestamp_update = 0;
        $this->create_user_id = Module::getAuthorUserId();
        $this->update_user_id = Module::getAuthorUserId();
        $this->slugifyAlias();
    }
272462
def _create_record(self, rtype, name, content):
        
        result = False
        name = self._relative_name(name)
        ttl = None

        # TODO: shoud assert that this is an int
        if self.ttl:
            ttl = self.ttl

        with localzone.manage(self.filename, self.origin, autosave=True) as zone:
            if zone.add_record(name, rtype, content, ttl=ttl):  # pylint: disable=no-member
                result = True

        LOGGER.debug("create_record: %s", result)
        return result
1035819
def prepare_error_record
      do_new
      batch_create_values.each do |attribute, value|
        form_ui = colunm_form_ui(value[:column])
        set_record_attribute(value[:column], attribute, value[:value]) unless form_ui && override_batch_create_value?(form_ui)
      end
    end
1268350
def _setID(self, id):
        
        if type(id) in (types.ListType, types.TupleType):
            try:
                for key in self._sqlPrimary:
                    value = id[0]
                    self.__dict__[key] = value
                    id = id[1:] # rest, go revursive
            except IndexError:
                raise 'Not enough id fields, required: %s' % len(self._sqlPrimary)
        elif len(self._sqlPrimary) <= 1:
            # It's a simple value
            key = self._sqlPrimary[0]
            self.__dict__[key] = id
        else:
            raise 'Not enough id fields, required: %s' % len(self._sqlPrimary)
        self._new = False
1227414
def add(cls, zone_id, version_id, record):
        """"""
        return cls.call('domain.zone.record.add', zone_id, version_id, record)
1022912
function (items, id_path, done) {

      done = typeof id_path == 'function' ? id_path : done

      var next = function(item, cb) {
        debug('creating %s', type)

        File.create(item[file_type], function(err, items) {
          if(err)
            return cb(err)

          item[file_type] = Array.prototype.slice.call(arguments, 1)
          debug('%s %s created', item[file_type].length, file_type)

          models[type].create(item, function(err, item) {
            if(err)
              return cb(err)

            debug('item created')

            if(id_path) {
              debug('Saving item to path')
              require('./paths')
              .files.add(id_path, item, function(err, path) {
                cb(err, item)
              })
            } else
              return cb(null, item)

          })
        })

      }

      if(items instanceof Array) {
        async.map(items, next,	done)
      } else {
        next(items, done)
      }
    }
854099
protected function after_create() {
        $cache = \cache::make('tool_dataprivacy', 'purpose');
        $cache->set($this->get('id'), $this->to_record());
    }
1063952
def add_xmlid(ctx, record, xmlid, noupdate=False):
    
    try:
        ref_id, __, __ = ctx.env['ir.model.data'].xmlid_lookup(xmlid)
    except ValueError:
        pass  # does not exist, we'll create a new one
    else:
        return ctx.env['ir.model.data'].browse(ref_id)
    if '.' in xmlid:
        module, name = xmlid.split('.')
    else:
        module = ''
        name = xmlid
    return ctx.env['ir.model.data'].create({
        'name': name,
        'module': module,
        'model': record._name,
        'res_id': record.id,
        'noupdate': noupdate,
    })
392638
def create(source, ids, force, pid_minter=None):
    """"""
    records_deprecation_warning()

    # Make sure that all imports are done with application context.
    from .api import Record
    from .models import RecordMetadata

    pid_minter = [process_minter(minter) for minter in pid_minter or []]

    data = json.load(source)

    if isinstance(data, dict):
        data = [data]

    if ids:
        assert len(ids) == len(data), 'Not enough identifiers.'

    for record, id_ in zip_longest(data, ids):
        id_ = id_ or uuid.uuid4()
        try:
            for minter in pid_minter:
                minter(id_, record)

            click.echo(Record.create(record, id_=id_).id)
        except exc.IntegrityError:
            if force:
                current_app.logger.warning(
                    "Trying to force insert: {0}".format(id_))
                # IMPORTANT: We need to create new transaction for
                # SQLAlchemy-Continuum as we are using no auto-flush
                # in Record.get_record.
                vm = current_app.extensions['invenio-db'].versioning_manager
                uow = vm.unit_of_work(db.session)
                uow.create_transaction(db.session)
                # Use low-level database model to retrieve an instance.
                model = RecordMetadata.query.get(id_)
                rec = Record(record, model=model).commit()
                current_app.logger.info("Created new revision {0}".format(
                    rec.revision_id))
                click.echo(rec.id)
            else:
                raise click.BadParameter(
                    'Record with id={0} already exists. If you want to '
                    'override its data use --force.'.format(id_),
                    param_hint='ids',
                )
        db.session.flush()
    db.session.commit()
11114
def add_oid(self,oid,value,label=None):
		""""""
		self.add_oid_entry(oid,'OBJECTID',value,label=label)