Sha256: cfcce6b5eded20a5ba4c5e6ade266d089636d1b0722e621026985ae85d766dda
Contents?: true
Size: 924 Bytes
Versions: 18
Compression:
Stored size: 924 Bytes
Contents
module Superstore module Tasks def dump(io) table_names.each do |column_family| io.puts run_command("DESCRIBE COLUMNFAMILY #{column_family}") io.puts end end def load(io) current_cql = '' io.each_line do |line| next if line.blank? current_cql << line.rstrip if current_cql =~ /;$/ keyspace_execute current_cql current_cql = '' end end end def table_names run_command('DESCRIBE COLUMNFAMILIES').split.sort end private def run_command(command) `echo "#{command};" | #{cqlsh} -2 -k #{keyspace} #{server}`.sub(/^(.*)$/, '').strip end def cqlsh ENV['CQLSH'] || 'cqlsh' end def keyspace Superstore::Base.config[:keyspace] end def server Superstore::Base.adapter.servers.first.gsub(/:.*/, '') end end end
Version data entries
18 entries across 18 versions & 1 rubygems