Module: Priam::Command::Cql::Create

Defined in:
lib/priam/command/cql/create.rb

Class Method Summary collapse

Class Method Details

.run(argv, input_stream = $stdin, output_stream = $stdout) ⇒ Object



3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/priam/command/cql/create.rb', line 3

def self.run(argv, input_stream=$stdin, output_stream=$stdout)
  params = Priam::Core::Common.parse_opts(argv)
  replication_factor = params[:replication_factor]
  keyspace = params[:keyspace]
  column_family = params[:column_family]
  super_column = params[:super_column]
  
  if keyspace
    output_stream.puts "create keyspace \#{keyspace}\n  with strategy_options={replication_factor:\#{replication_factor}}\n  and placement_strategy = 'org.apache.cassandra.locator.SimpleStrategy';\n    EOF\n    if column_family\n      output_stream.puts <<-EOF\nuse \#{keyspace};\ncreate column family \#{column_family}\n  with column_type = Standard -- or Super\n  and comparator = BytesType\n  and subcomparator = BytesType;\n    EOF\n    end\n  end\n  \n\nend\n"