在cassandra触发器中获取列名及其值

时间:2016-04-28 02:49:39

标签: cassandra cassandra-2.0 cql

我有这个cassandra触发器

public class AuditTrigger implements ITrigger
{

private Properties properties = loadProperties();

public Collection<Mutation> augment(Partition update)
{
    String auditKeyspace = properties.getProperty("keyspace");
    String auditTable = properties.getProperty("table");

    RowUpdateBuilder audit = new RowUpdateBuilder(Schema.instance.getCFMetaData(auditKeyspace, auditTable),
                                                  FBUtilities.timestampMicros(),
                                                  UUIDGen.getTimeUUID());
    audit.add("keyspace_name", update.metadata().ksName);
    audit.add("table_name", update.metadata().cfName);
    audit.add("primary_key", update.metadata().getKeyValidator().getString(update.partitionKey().getKey()));

    return Collections.singletonList(audit.build());
}
}

我可以获取插入的值及其列名吗?

0 个答案:

没有答案