RC.insert {RCassandra}R Documentation

Update functions to insert data into Cassandra

Description

RC.insert updates or inserts new column/value pairs

RC.mutate batchwise updates or inserts a list of keys, column families and columns/values.

Usage

RC.insert(conn, c.family, key, column, value = NULL,
          comparator = NULL, validator = NULL)
RC.mutate(conn, mutation)

Arguments

conn

connection handle obtained from RC.connect

c.family

name of the column family (string)

key

row key name (string) or a vector of (preferably contiguous) keys to use with the column names vector

column

column name - any vector supported by the comparator

value

optinally values to add into the columns - if specified, must be the same length as column. If NULL only the column is created

comparator

comparator (column name type) to be used - see RC.get for details

validator

validator (value type) to be used - see RC.get for details

mutation

a structure describing the desired mutation (see Cassandra documentation). In its simplest form it is a nested list: list(row.key1=list(c.family1=list(col1=val1, ...), ...), ...) so to add column "foo" with value "bar" to column family "table" and row "key" the mutation would be list(key=list(table=list(foo="bar"))). The innermost list can optionally be a character vector (if unnamed it specifies the column names, otherwise names are column names and elements are values). Only string keys and column names are supproted.

Value

conn

Note

RC.insert supports multi-column insertions where column and value are vectors. For the scalar case insert message is used, for vector case batch_mutate. If key is a scalar, all column/value pairs are added to that row key. Alternatively, key can be a vector of the same length as column in which case the mutation will consist of key/column/value triplets. Note that key should be contiguous as the mutation will only group contiguous sequences (see coalesce from the fastmatch package for a fast way of obtaining contiguous sequences).

RC.insert honors both the validator and comparator (the latter is taken from the cache if not specified).

RC.mutate currently only uses "UTF8Type" validator and comparator as there is no way to specify either in the mutation object.

Cassandra requires timestamps on all objects that specify columns/values for conflict resolution. All functions above generate such timestamps from the system time as POSIX time in milliseconds.

Author(s)

Simon Urbanek

See Also

RC.connect, RC.use, RC.get


[Package RCassandra version 0.1-3 Index]