def keyspace_delete(self,machine_id,name):
		"""Delete keyspace with given name on specified machine_id """
		print "->>>in delete keyspace function"
		sys = SystemManager(machine_id)
		key = keyspace()
		if (key.keyspace_contains(machine_id,name)):
			sys.drop_keyspace(name)
		sys.close()
		return 1
	def keyspace_delete(self,machine_id,keyspace_name):
		"""Delete keyspace with given name on specified machine_id """
		if (self.keyspace_contains(keyspace_name) == False):
			print "Error : Keyspace with this name dosenot exist."
			return False
		sys = SystemManager(machine_id)
		sys.drop_keyspace(keyspace_name)
		self.keyspace_columnfamily_list('localhost:9160')
		sys.close()
		return True
 def keyspace_delete(self, machine_id, keyspace_name):
     """Delete keyspace with given name on specified machine_id """
     if (self.keyspace_contains(keyspace_name) == False):
         print "Error : Keyspace with this name dosenot exist."
         return False
     sys = SystemManager(machine_id)
     sys.drop_keyspace(keyspace_name)
     self.keyspace_columnfamily_list('localhost:9160')
     sys.close()
     return True
Example #4
0
def create_keyspaces(replication):
    print "Creating Key Spaces"
    f = open(APPSCALE_HOME + '/.appscale/my_private_ip', 'r')
    host = f.read()
    sys = SystemManager(host + ":" + str(CASS_PORT))

    try:
        sys.drop_keyspace('Keyspace1')
    except pycassa.cassandra.ttypes.InvalidRequestException, e:
        pass
def create_keyspaces(replication):
  print "Creating Key Spaces" 
  f = open(APPSCALE_HOME + '/.appscale/my_private_ip', 'r')
  host = f.read()
  sys = SystemManager(host + ":" + str(CASS_PORT))

  try:
    sys.drop_keyspace('Keyspace1')
  except pycassa.cassandra.ttypes.InvalidRequestException, e:
    pass
	def keyspace_delete(self,machine_id,keyspace_name):
		"""Delete keyspace with given name on specified machine_id """
		keyspace.error = "Unknown error occur please check your inputs"
		if (self.keyspace_contains(keyspace.local_system,keyspace_name) == False):
			keyspace.error = "Desired Keyspace does not exist."
			return False
		try:
			sys = SystemManager(machine_id)
		except Exception as e:
			print e
			return False
		try:
			sys.drop_keyspace(keyspace_name)
		except Exception as e:
			print e
			return False
		sys.close()
		return True
Example #7
0
import pycassa
from pycassa.system_manager import *

sys = SystemManager()
keyspace = settings.CASSANDRA_KEYSPACE

if keyspace in sys.list_keyspaces():
    msg = 'Looks like you already have a %s keyspace.\nDo you ' % keyspace
    msg += 'want to delete it and recreate it? All current data will '
    msg += 'be deleted! (y/n): '
    resp = raw_input(msg)
    if not resp or resp[0] != 'y':
        print "Ok, then we're done here."
        import sys
        sys.exit(0)
    sys.drop_keyspace(keyspace)

sys.create_keyspace(keyspace, SIMPLE_STRATEGY, {'replication_factor': '1'})
sys.create_column_family(keyspace, 'Counters',
    comparator_type=UTF8_TYPE,
    default_validation_class='CounterColumnType',
    key_validation_class=UTF8_TYPE,
)
sys.create_column_family(keyspace, 'Followers',
    comparator_type=LONG_TYPE,
    default_validation_class=LONG_TYPE,
    key_validation_class=LONG_TYPE,
)
sys.create_column_family(keyspace, 'UserTimeline',
    comparator_type=LONG_TYPE,
    default_validation_class=LONG_TYPE,
Example #8
0
import pycassa
from pycassa.system_manager import *

sys = SystemManager()
keyspace = settings.CASSANDRA_KEYSPACE

if keyspace in sys.list_keyspaces():
    msg = 'Looks like you already have a %s keyspace.\nDo you ' % keyspace
    msg += 'want to delete it and recreate it? All current data will '
    msg += 'be deleted! (y/n): '
    resp = raw_input(msg)
    if not resp or resp[0] != 'y':
        print "Ok, then we're done here."
        import sys
        sys.exit(0)
    sys.drop_keyspace(keyspace)

sys.create_keyspace(keyspace, SIMPLE_STRATEGY, {'replication_factor': '1'})
sys.create_column_family(
    keyspace,
    'Counters',
    comparator_type=UTF8_TYPE,
    default_validation_class='CounterColumnType',
    key_validation_class=UTF8_TYPE,
)
sys.create_column_family(
    keyspace,
    'Followers',
    comparator_type=LONG_TYPE,
    default_validation_class=LONG_TYPE,
    key_validation_class=LONG_TYPE,