I'm trying to create column family with this code
public void CreateAColumnFamily() { using (var db = new CassandraContext(keyspace:"Earth", server: Server)) { CassandraColumnFamily cf = db.GetColumnFamily("People"); if (cf == null) { db.ExecuteNonQuery(@"CREATE COLUMNFAMILY People ( KEY ascii PRIMARY KEY, FirstName text, LastName text, Age int, Title text );"); } cf = db.GetColumnFamily("People"); } }
But nothing to happening. If i just to execute command create column family People in cassandra-cli - column family is creating. What i do wrong?
Your code assumes that they column family 'People' already exists, and it shouldn't if you are trying to create it.
To create a column family:
Source: Example from fluent cassandra github.
Also as a side note. I struggled with finding documentation for fluent cassandra and it looks like you did too. If you are learning Cassandra try out the datastax C# driver... lots of documentation and a bigger community behind it.