var keyspace = "mydb";
var datacentersReplicationFactors = new Dictionary<string, int>(0);
var replication = ReplicationStrategies.CreateNetworkTopologyStrategyReplicationProperty(datacentersReplicationFactors);
using (var cluster = Cluster.Builder().AddContactPoints("my_ip").Build())
using (var session = cluster.Connect())
{
session.CreateKeyspaceIfNotExists(keyspace, replication, true);
session.ChangeKeyspace(keyspace);
var entityTable = new Table<Models.Entity>(session);
var attributeTable = new Table<Models.Attribute>(session);
entityTable.CreateIfNotExists(); // Worked
attributeTable.CreateIfNotExists(); // Worked
entityTable.Delete(); // Does nothing
attributeTable.Delete(); // Does nothing
}
編輯:沒有使用原始查詢session.Execute("DROP TABLE entities;");
工作正常。如何使用C#Datastax驅動程序刪除Cassandra上的表?
我得到 「行0:-1不匹配輸入 '' 期待K_WHERE」 –
Almis
被刪除返回查詢什麼()? – CodeFuller
嗯,似乎這是DELETE命令,而不是DROP,我得到'{DELETE FROM entities}' – Almis