Amazon Keyspaces(Apache Cassandra)不支持无日志批处理。每个批处理必须登录以确保事务的原子性和一致性。如果您想忽略批量化,您可以使用Apache Cassandra的简单插入。以下是Java驱动程序中简单插入的示例代码:
String query = "INSERT INTO my_table (id, column1, column2) VALUES (?, ?, ?)";
PreparedStatement statement = session.prepare(query);
// Batch and execute the insertion
for (int i = 0; i < data.size(); i++) {
BoundStatement bound = statement.bind(data.getId(i), data.getColumn1(i), data.getColumn2(i));
session.execute(bound);
}