Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add_column_family not documented #55

Closed
sdruon-spotuse opened this issue Nov 17, 2010 · 3 comments
Closed

add_column_family not documented #55

sdruon-spotuse opened this issue Nov 17, 2010 · 3 comments

Comments

@sdruon-spotuse
Copy link

Hello,

The function add_column_family is not documented.
Could you tell how to use it?

Thanks a lot in advance

Sebastien Druon

@ryanking
Copy link
Contributor

The cassandra 0.7 support is still experimental. You're going to have to just read the code for now.

@sdruon-spotuse
Copy link
Author

The code says that the method takes "cf_def" as argument:
add_column_family(cf_def)
What is cf_def then?

Thanks a lot in advance

Sébastien Druon

@kyptin
Copy link

kyptin commented Mar 24, 2011

I figured out a few things about cf_def should be. I'm posting it here in case it's helpful to someone.

I'm able to get the cf_def for a keyspace that I added through the cassandra-cli tool. First of all, here are the commands that I used to create the keyspace:

create keyspace testing;
use testing;
create column family ServerData with column_type=Standard and comparator=LongType;

Then, here's how I access the cf_def object from within Ruby code (or irb):

require 'cassandra/0.7'
connection = Cassandra.new('testing', '127.0.0.1:9160')
keyspaces = connection.send('client').describe_keyspaces
keyspace_def = keyspaces.find{|ks| ks.name=='testing'}
cf_def = keyspace_def.cf_defs.first

Then, puts cf_def.inspect prints:

<CassandraThrift::CfDef keyspace:"testing", name:"ServerData", column_type:"Standard", comparator_type:"org.apache.cassandra.db.marshal.LongType", comment:"", row_cache_size:0.0, key_cache_size:200000.0, read_repair_chance:1.0, column_metadata:[], gc_grace_seconds:864000, default_validation_class:"org.apache.cassandra.db.marshal.BytesType", id:1035, min_compaction_threshold:4, max_compaction_threshold:32, row_cache_save_period_in_seconds:0, key_cache_save_period_in_seconds:14400, memtable_flush_after_mins:1440, memtable_throughput_in_mb:364, memtable_operations_in_millions:1.70625>

I still haven't figured out how to create a CassandraThrift::CfDef instance, but at least that's a start.

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants