Create kvstore assuming some parameters' storage types are row_sparse.

    Parameters
    ----------
    kvstore : KVStore or str
        The kvstore.

    Returns
    -------
    kvstore : KVStore
    update_on_kvstore : bool. Always True.
556808
def _create_sparse_kvstore(kvstore):
    
    # always update on kvstore
    update_on_kvstore = True
    if isinstance(kvstore, kvs.KVStore):
        kv = kvstore
    elif isinstance(kvstore, str):
        kv = kvs.create(kvstore)
    else:
        raise TypeError("Cannot create '%s' KVStore with row_sparse parameters. "
                        "The type must be KVStore or str." % kvstore)
    return (kv, update_on_kvstore)
1215207
private void createForeignKeys(Set<ForeignKey> allForeignKeys, Map<Column, ColumnDescriptor> allColumns, Store store) {
        // Foreign keys
        for (ForeignKey foreignKey : allForeignKeys) {
            ForeignKeyDescriptor foreignKeyDescriptor = store.create(ForeignKeyDescriptor.class);
            foreignKeyDescriptor.setName(foreignKey.getName());
            foreignKeyDescriptor.setDeferrability(foreignKey.getDeferrability().name());
            foreignKeyDescriptor.setDeleteRule(foreignKey.getDeleteRule().name());
            foreignKeyDescriptor.setUpdateRule(foreignKey.getUpdateRule().name());
            for (ForeignKeyColumnReference columnReference : foreignKey.getColumnReferences()) {
                ForeignKeyReferenceDescriptor keyReferenceDescriptor = store.create(ForeignKeyReferenceDescriptor.class);
                // foreign key table and column
                Column foreignKeyColumn = columnReference.getForeignKeyColumn();
                ColumnDescriptor foreignKeyColumnDescriptor = allColumns.get(foreignKeyColumn);
                keyReferenceDescriptor.setForeignKeyColumn(foreignKeyColumnDescriptor);
                // primary key table and column
                Column primaryKeyColumn = columnReference.getPrimaryKeyColumn();
                ColumnDescriptor primaryKeyColumnDescriptor = allColumns.get(primaryKeyColumn);
                keyReferenceDescriptor.setPrimaryKeyColumn(primaryKeyColumnDescriptor);
                foreignKeyDescriptor.getForeignKeyReferences().add(keyReferenceDescriptor);
            }
        }
    }
804042
def store(self, store_item):
        
        required_keys = {"type": str, "timestamp": float}
        
        if not isinstance(store_item, dict):
            raise TypeError("The stored item should be a dict")
           
        for k, v in required_keys.items(): 
            if k not in store_item:
                raise AttributeError("{} is not available. Please add it.".format(k))
            
            if not isinstance(store_item[k], v):
                raise TypeError("{} is not a {}. Please change it. ".format(k, v))
                #       
#         # TODO: CREATE FILTER FOR PERSISTENCE METHOD. Make sure it has the necessary data
#         to_store = {'field1': thing.field1,
#                     'date_field': thing.date_field,
#                     }
#         to_store['stuff'] = Binary(cPickle.dumps(thing.stuff))
        # Respect any soft-quota on write - raises if stats().totals.size > quota 
        self._arctic_lib.check_quota()
        self._collection.update(store_item, store_item, upsert=True)
864521
def AddDatastore(self, urn):
    
    if urn not in self._datastores:
      self._datastores.add(urn)
      return True
    return False
723245
def add_item(self, sqla_col_type, item, key_specific=None):
        
        if key_specific is not None:
            self.setdefault(key_specific, {})[sqla_col_type] = item
        else:
            self[sqla_col_type] = item
138160
def put(self, key, value):
    ''''''
    for store in self._stores:
      store.put(key, value)
660620
def store(self):
        
        if self._store is None:
            config = self.config.get('store', {})
            if 'query' in config and 'update' in config:
                self._store = sparql_store(config.get('query'),
                                           config.get('update'))
            else:
                self._store = plugin.get('IOMemory', Store)()
            log.debug('Created store: %r', self._store)
        return self._store
310638
def prepare_sparse_params(self, param_rowids):
        '''
        '''
        if not self._kvstore:
            return
        assert(isinstance(param_rowids, dict))
        for param_name, rowids in param_rowids.items():
            if isinstance(rowids, (tuple, list)):
                rowids_1d = []
                for r in rowids:
                    rowids_1d.append(r.reshape((-1,)).astype(np.int64))
                rowid = mx.nd.concat(*rowids_1d, dim=0)
            else:
                rowid = rowids
            param_idx = self._exec_group.param_names.index(param_name)
            param_val = self._exec_group.param_arrays[param_idx]
            self._kvstore.row_sparse_pull(param_name, param_val, row_ids=rowid,
                                          priority=-param_idx)
1070167
def record_store(store)
      store = RecordCache::Base.stores[store] || ActiveSupport::Cache.lookup_store(store) if store.is_a?(Symbol)
      store ||= Rails.cache if defined?(::Rails)
      store ||= ActiveSupport::Cache.lookup_store(:memory_store)
      RecordCache::MultiRead.test(store)
    end
275095
def create_table_index(self, key, **kwargs):
        

        # version requirements
        _tables()
        s = self.get_storer(key)
        if s is None:
            return

        if not s.is_table:
            raise TypeError(
                "cannot create table index on a Fixed format store")
        s.create_index(**kwargs)
623510
def datastore(self, datastore):
        
        if isinstance(datastore, DataStore):
            self._datastore = datastore
        else:
            raise Exception('%s is not a valid datastore.' % datastore)
1220202
def _appendstore(self, store):
        """"""
        if not store.bitlength:
            return
        # Set new array offset to the number of bits in the final byte of current array.
        store = offsetcopy(store, (self.offset + self.bitlength) % 8)
        if store.offset:
            # first do the byte with the join.
            joinval = (self._rawarray.pop() & (255 ^ (255 >> store.offset)) |
                       (store.getbyte(0) & (255 >> store.offset)))
            self._rawarray.append(joinval)
            self._rawarray.extend(store._rawarray[1:])
        else:
            self._rawarray.extend(store._rawarray)
        self.bitlength += store.bitlength
477607
def create(self, data={}, store=None):
        
        _store = store or self.store
        _data = self._build_opr_data(data, _store) if data else self._opr_data
        return self._process('opr/create', _data)
1033027
def get_storage(store_type, data_type, name, args = {})
      full_name = "#{key}_#{name}"
      result = nil
      case store_type.to_sym
      when :redis
        result = get_redis_storage(data_type, full_name.to_s, args)
      when :local
        @_local_cache ||= {}
        unless @_local_cache[full_name.to_s]
          @_local_cache[full_name.to_s] = get_local_storage(data_type, full_name.to_s, args)
        end
        result = @_local_cache[full_name.to_s]
      else
        raise TypeError.new("Unsupported caching storage type encountered: #{store_type}")
      end
      unless full_name == "#{key}_registry_#{key}"
        registry[name.to_s] = data_type
      end
      result
    end
784902
def create(from_records, to_records, index_columns, ignore_columns=None):
    
    from_indexed = records.index(from_records, index_columns)
    to_indexed = records.index(to_records, index_columns)

    if ignore_columns is not None:
        from_indexed = records.filter_ignored(from_indexed, ignore_columns)
        to_indexed = records.filter_ignored(to_indexed, ignore_columns)

    return create_indexed(from_indexed, to_indexed, index_columns)
969709
function create(item, store) {
      var data = store.rootData.asObject();
      // New item has id
      if (item[store.idProperty]) {
        // Check item duplicated
        if (!data[item[store.idProperty]]) {
          // Create item
          data[item[store.idProperty]] = item;
        } else {
          // Item already exists
          return vcomet.error.log(
            "store",
            "Item with id " + item[store.idProperty] + " already exists"
          );
        }
      } else {
        // Add id value to item
        item[store.idProperty] = Object.keys(data).length.toString();
        // Create item
        data[item[store.idProperty]] = item;
      }
      if (item[store.idProperty]) {
        // Update store data
        store.rootData = store.data = new Result(data, store, store.data.__sorted);
        // Update store data items length
        store.size = Object.keys(store.data).length;
        // Trigger onSourceChanged event
        vcomet.triggerCallback("onSourceChanged", store);
        return item;
      } else {
        return vcomet.error.log("store", "Incorrect item format");
      }
    }
261674
def index_run(record_path, keep_json, check_duplicate):
    
    from .config import ConfigStore
    from .indexer import Indexer
    cfstore = ConfigStore()
    indexer = Indexer(cfstore, check_duplicate, keep_json, record_path)
    indexer.index_all()