当前位置: 首页>>代码示例>>Python>>正文


Python ColumnFamily.remove方法代码示例

本文整理汇总了Python中pycassa.columnfamily.ColumnFamily.remove方法的典型用法代码示例。如果您正苦于以下问题:Python ColumnFamily.remove方法的具体用法?Python ColumnFamily.remove怎么用?Python ColumnFamily.remove使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在pycassa.columnfamily.ColumnFamily的用法示例。


在下文中一共展示了ColumnFamily.remove方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: TestBigInt

# 需要导入模块: from pycassa.columnfamily import ColumnFamily [as 别名]
# 或者: from pycassa.columnfamily.ColumnFamily import remove [as 别名]
class TestBigInt(unittest.TestCase):

    @classmethod
    def setup_class(cls):
        sys = SystemManager()
        sys.create_column_family(TEST_KS, 'StdInteger', comparator_type=IntegerType())

    @classmethod
    def teardown_class(cls):
        sys = SystemManager()
        sys.drop_column_family(TEST_KS, 'StdInteger')

    def setUp(self):
        self.key = 'TestBigInt'
        self.cf = ColumnFamily(pool, 'StdInteger')

    def tearDown(self):
        self.cf.remove(self.key)

    def test_negative_integers(self):
        self.cf.insert(self.key, {-1: '-1'})
        self.cf.insert(self.key, {-12342390: '-12342390'})
        self.cf.insert(self.key, {-255: '-255'})
        self.cf.insert(self.key, {-256: '-256'})
        self.cf.insert(self.key, {-257: '-257'})
        for key, cols in self.cf.get_range():
            self.assertEquals(str(cols.keys()[0]), cols.values()[0])
开发者ID:caruccio,项目名称:pycassa,代码行数:29,代码来源:test_autopacking.py

示例2: remove_column

# 需要导入模块: from pycassa.columnfamily import ColumnFamily [as 别名]
# 或者: from pycassa.columnfamily.ColumnFamily import remove [as 别名]
def remove_column(columnFamily, uid, columns) :
	"To remove columns from a key"
	try:
		column = ColumnFamily(pool, columnFamily)
		column.remove(uid,columns)
	except:
		return {'status':0}
开发者ID:redjohn19,项目名称:CloudMajor,代码行数:9,代码来源:operations.py

示例3: column_family_remove

# 需要导入模块: from pycassa.columnfamily import ColumnFamily [as 别名]
# 或者: from pycassa.columnfamily.ColumnFamily import remove [as 别名]
	def column_family_remove(self,machine_id,keyspace_name,column_family_name,key):
		"""Remove a key from column family for a given keyspace """
		if (self.keyspace_contains(keyspace_name,column_family_name) == False):
			print "Error : Keyspace:column family could not be found."
			return False
		pool = ConnectionPool(keyspace = keyspace_name, server_list =  keyspace.server_ips, prefill=False)
		col_fam = ColumnFamily(pool, column_family_name)
		col_fam.remove(key)
		return True
开发者ID:KedarBiradar,项目名称:CassandraBrowserTool,代码行数:11,代码来源:backend_code.py

示例4: truncate_build_metadata

# 需要导入模块: from pycassa.columnfamily import ColumnFamily [as 别名]
# 或者: from pycassa.columnfamily.ColumnFamily import remove [as 别名]
    def truncate_build_metadata(self):
        """Truncates all derived build metadata.

        This bulk removes all build metadata and should not be performed
        unless you want to reload all derived data!
        """
        for cf in ['slaves', 'masters', 'builders', 'builds']:
            cf = ColumnFamily(self.pool, cf)
            cf.truncate()

        cf = ColumnFamily(self.pool, 'indices')
        for key in BUILD_METADATA_INDICES:
            cf.remove(key)

        cf = ColumnFamily(self.pool, 'simple_indices')
        for key in BUILD_METADATA_SIMPLE_INDICES:
            cf.remove(key)

        cf = ColumnFamily(self.pool, 'counters')
        for key in BUILD_METADATA_COUNTERS:
            cf.remove(key)

        cf = ColumnFamily(self.pool, 'super_counters')
        for key in BUILD_METADATA_SUPER_COUNTERS:
            cf.remove(key)
开发者ID:AutomatedTester,项目名称:mozilla-build-analyzer,代码行数:27,代码来源:cassandra.py

示例5: TestTypeErrors

# 需要导入模块: from pycassa.columnfamily import ColumnFamily [as 别名]
# 或者: from pycassa.columnfamily.ColumnFamily import remove [as 别名]
class TestTypeErrors(unittest.TestCase):
    def test_packing_enabled(self):
        self.cf = ColumnFamily(pool, "Standard1")
        self.cf.insert("key", {"col": "val"})
        assert_raises(TypeError, self.cf.insert, args=("key", {123: "val"}))
        assert_raises(TypeError, self.cf.insert, args=("key", {"col": 123}))
        assert_raises(TypeError, self.cf.insert, args=("key", {123: 123}))
        self.cf.remove("key")

    def test_packing_disabled(self):
        self.cf = ColumnFamily(pool, "Standard1", autopack_names=False, autopack_values=False)
        self.cf.insert("key", {"col": "val"})
        assert_raises(TypeError, self.cf.insert, args=("key", {123: "val"}))
        assert_raises(TypeError, self.cf.insert, args=("key", {"col": 123}))
        assert_raises(TypeError, self.cf.insert, args=("key", {123: 123}))
        self.cf.remove("key")
开发者ID:robingustafsson,项目名称:pycassa,代码行数:18,代码来源:test_autopacking.py

示例6: remove

# 需要导入模块: from pycassa.columnfamily import ColumnFamily [as 别名]
# 或者: from pycassa.columnfamily.ColumnFamily import remove [as 别名]
    def remove(self, instance, columns=None, write_consistency_level=None):
        """
        Removes a stored instance.

        The `columns` parameter is a list of columns that should be removed.
        If this is left as the default value of ``None``, the entire stored
        instance will be removed.

        """
        if self.super:
            return ColumnFamily.remove(self, instance.key,
                                       super_column=instance.super_column,
                                       columns=columns,
                                       write_consistency_level=write_consistency_level)
        else:
            return ColumnFamily.remove(self, instance.key, columns,
                                       write_consistency_level=write_consistency_level)
开发者ID:gustavopinto,项目名称:pycassa,代码行数:19,代码来源:columnfamilymap.py

示例7: create_new_thread

# 需要导入模块: from pycassa.columnfamily import ColumnFamily [as 别名]
# 或者: from pycassa.columnfamily.ColumnFamily import remove [as 别名]
    def create_new_thread(self, thread_name):
        threads = ColumnFamily(self.conn, 'threads')

        ret = list(threads.get_range())
        if len(ret) > 99:
            oldest_thread = self._get_oldest_thread()
            oldest_thread_id = str(oldest_thread['thread_id'])
            threads.remove(oldest_thread_id)
            self._drop_cf(oldest_thread_id)

        thread_id = '%s' % random.randint(1,sys.maxint)

        dt = datetime.datetime.today()
        str_dt = dt.strftime('%Y-%m-%d %H:%M:%S')
        threads.insert(thread_id, {'thread_name': thread_name, 'post_count': '1', 'create_time': str_dt, 'update_time': str_dt})

        self._create_cf(thread_id)
        return thread_id
开发者ID:hiroakis,项目名称:simple-bbs-cassandra,代码行数:20,代码来源:app.py

示例8: test_validated_columns

# 需要导入模块: from pycassa.columnfamily import ColumnFamily [as 别名]
# 或者: from pycassa.columnfamily.ColumnFamily import remove [as 别名]
    def test_validated_columns(self):
        sys = SystemManager()
        sys.create_column_family(TEST_KS, "Validators")
        sys.alter_column(TEST_KS, "Validators", "long", LongType())
        sys.alter_column(TEST_KS, "Validators", "int", IntegerType())
        sys.alter_column(TEST_KS, "Validators", "time", TimeUUIDType())
        sys.alter_column(TEST_KS, "Validators", "lex", LexicalUUIDType())
        sys.alter_column(TEST_KS, "Validators", "ascii", AsciiType())
        sys.alter_column(TEST_KS, "Validators", "utf8", UTF8Type())
        sys.alter_column(TEST_KS, "Validators", "bytes", BytesType())
        sys.close()

        cf = ColumnFamily(pool, "Validators")
        key = "key1"

        col = {"long": 1L}
        cf.insert(key, col)
        assert_equal(cf.get(key)["long"], 1L)

        col = {"int": 1}
        cf.insert(key, col)
        assert_equal(cf.get(key)["int"], 1)

        col = {"time": TIME1}
        cf.insert(key, col)
        assert_equal(cf.get(key)["time"], TIME1)

        col = {"lex": uuid.UUID(bytes="aaa aaa aaa aaaa")}
        cf.insert(key, col)
        assert_equal(cf.get(key)["lex"], uuid.UUID(bytes="aaa aaa aaa aaaa"))

        col = {"ascii": "aaa"}
        cf.insert(key, col)
        assert_equal(cf.get(key)["ascii"], "aaa")

        col = {"utf8": u"a\u0020"}
        cf.insert(key, col)
        assert_equal(cf.get(key)["utf8"], u"a\u0020")

        col = {"bytes": "aaa"}
        cf.insert(key, col)
        assert_equal(cf.get(key)["bytes"], "aaa")

        cf.remove(key)
开发者ID:robingustafsson,项目名称:pycassa,代码行数:46,代码来源:test_autopacking.py

示例9: test_validated_columns

# 需要导入模块: from pycassa.columnfamily import ColumnFamily [as 别名]
# 或者: from pycassa.columnfamily.ColumnFamily import remove [as 别名]
    def test_validated_columns(self):
        sys = SystemManager()
        sys.create_column_family(TEST_KS, 'Validators',)
        sys.alter_column(TEST_KS, 'Validators', 'long', LONG_TYPE)
        sys.alter_column(TEST_KS, 'Validators', 'int', INT_TYPE)
        sys.alter_column(TEST_KS, 'Validators', 'time', TIME_UUID_TYPE)
        sys.alter_column(TEST_KS, 'Validators', 'lex', LEXICAL_UUID_TYPE)
        sys.alter_column(TEST_KS, 'Validators', 'ascii', ASCII_TYPE)
        sys.alter_column(TEST_KS, 'Validators', 'utf8', UTF8_TYPE)
        sys.alter_column(TEST_KS, 'Validators', 'bytes', BYTES_TYPE)
        sys.close()

        cf = ColumnFamily(pool, 'Validators')
        key = 'key1'

        col = {'long':1L}
        cf.insert(key, col)
        assert_equal(cf.get(key)['long'], 1L)

        col = {'int':1}
        cf.insert(key, col)
        assert_equal(cf.get(key)['int'], 1)

        col = {'time':TIME1}
        cf.insert(key, col)
        assert_equal(cf.get(key)['time'], TIME1)

        col = {'lex':uuid.UUID(bytes='aaa aaa aaa aaaa')}
        cf.insert(key, col)
        assert_equal(cf.get(key)['lex'], uuid.UUID(bytes='aaa aaa aaa aaaa'))

        col = {'ascii':'aaa'}
        cf.insert(key, col)
        assert_equal(cf.get(key)['ascii'], 'aaa')

        col = {'utf8':u'a\u0020'}
        cf.insert(key, col)
        assert_equal(cf.get(key)['utf8'], u'a\u0020')

        col = {'bytes':'aaa'}
        cf.insert(key, col)
        assert_equal(cf.get(key)['bytes'], 'aaa')

        cf.remove(key)
开发者ID:amxn,项目名称:pycassa,代码行数:46,代码来源:test_autopacking.py

示例10: test_validated_columns

# 需要导入模块: from pycassa.columnfamily import ColumnFamily [as 别名]
# 或者: from pycassa.columnfamily.ColumnFamily import remove [as 别名]
    def test_validated_columns(self):
        sys = SystemManager()
        sys.create_column_family(TEST_KS, 'Validators',)
        sys.alter_column(TEST_KS, 'Validators', 'long', LongType())
        sys.alter_column(TEST_KS, 'Validators', 'int', IntegerType())
        sys.alter_column(TEST_KS, 'Validators', 'time', TimeUUIDType())
        sys.alter_column(TEST_KS, 'Validators', 'lex', LexicalUUIDType())
        sys.alter_column(TEST_KS, 'Validators', 'ascii', AsciiType())
        sys.alter_column(TEST_KS, 'Validators', 'utf8', UTF8Type())
        sys.alter_column(TEST_KS, 'Validators', 'bytes', BytesType())
        sys.close()

        cf = ColumnFamily(pool, 'Validators')
        key = 'key1'

        col = {'long':1L}
        cf.insert(key, col)
        assert_equal(cf.get(key)['long'], 1L)

        col = {'int':1}
        cf.insert(key, col)
        assert_equal(cf.get(key)['int'], 1)

        col = {'time':TIME1}
        cf.insert(key, col)
        assert_equal(cf.get(key)['time'], TIME1)

        col = {'lex':uuid.UUID(bytes='aaa aaa aaa aaaa')}
        cf.insert(key, col)
        assert_equal(cf.get(key)['lex'], uuid.UUID(bytes='aaa aaa aaa aaaa'))

        col = {'ascii':'aaa'}
        cf.insert(key, col)
        assert_equal(cf.get(key)['ascii'], 'aaa')

        col = {'utf8':u'a\u0020'}
        cf.insert(key, col)
        assert_equal(cf.get(key)['utf8'], u'a\u0020')

        col = {'bytes':'aaa'}
        cf.insert(key, col)
        assert_equal(cf.get(key)['bytes'], 'aaa')

        cf.remove(key)
开发者ID:caruccio,项目名称:pycassa,代码行数:46,代码来源:test_autopacking.py

示例11: truncate_log_metadata

# 需要导入模块: from pycassa.columnfamily import ColumnFamily [as 别名]
# 或者: from pycassa.columnfamily.ColumnFamily import remove [as 别名]
    def truncate_log_metadata(self):
        for cf in ['build_timelines']:
            cf = ColumnFamily(self.pool, cf)
            cf.truncate()

        cf = ColumnFamily(self.pool, 'indices')
        for key in LOG_METADATA_INDICES:
            cf.remove(key)

        cf = ColumnFamily(self.pool, 'counters')
        for key in LOG_METADATA_COUNTERS:
            cf.remove(key)

        cf = ColumnFamily(self.pool, 'super_counters')
        for key in LOG_METADATA_SUPER_COUNTERS:
            cf.remove(key)

        cf = ColumnFamily(self.pool, 'builds')
        batch = cf.batch()
        # Remove log parsing state from builds.
        for key, cols in cf.get_range(columns=['log_parsing_version']):
            if 'log_parsing_version' not in cols:
                continue

            batch.remove(key, ['log_parsing_version'])

        batch.send()
开发者ID:AutomatedTester,项目名称:mozilla-build-analyzer,代码行数:29,代码来源:cassandra.py

示例12: column_family_remove

# 需要导入模块: from pycassa.columnfamily import ColumnFamily [as 别名]
# 或者: from pycassa.columnfamily.ColumnFamily import remove [as 别名]
 def column_family_remove(self, keyspace_name, column_family_name, key):
     """Remove a key from column family for a given keyspace """
     keyspace.error = "Unknown error occur please check your inputs"
     if not self.keyspace_contains(keyspace.local_system, keyspace_name, column_family_name):
         keyspace.error = "Desired Keyspace,Column Family pair could not be found."
         return False
     try:
         pool = ConnectionPool(keyspace=keyspace_name, server_list=keyspace.server_ips, prefill=False)
     except Exception as e:
         print e
         return False
     try:
         col_fam = ColumnFamily(pool, column_family_name)
     except Exception as e:
         print e
         return False
     try:
         col_fam.remove(key)
     except Exception as e:
         print e
         return False
     return True
开发者ID:neel1438,项目名称:Cassandra-BigDataEditor,代码行数:24,代码来源:app.py

示例13: TestDateTypes

# 需要导入模块: from pycassa.columnfamily import ColumnFamily [as 别名]
# 或者: from pycassa.columnfamily.ColumnFamily import remove [as 别名]
class TestDateTypes(unittest.TestCase):
    def _compare_dates(self, d1, d2):
        self.assertEquals(d1.timetuple(), d2.timetuple())
        self.assertEquals(int(d1.microsecond / 1e3), int(d2.microsecond / 1e3))

    def test_compatibility(self):
        self.cf = ColumnFamily(pool, "Standard1")
        self.cf.column_validators["date"] = OldPycassaDateType()

        d = datetime.utcnow()
        self.cf.insert("key1", {"date": d})
        self._compare_dates(self.cf.get("key1")["date"], d)

        self.cf.column_validators["date"] = IntermediateDateType()
        self._compare_dates(self.cf.get("key1")["date"], d)
        self.cf.insert("key1", {"date": d})
        self._compare_dates(self.cf.get("key1")["date"], d)

        self.cf.column_validators["date"] = DateType()
        self._compare_dates(self.cf.get("key1")["date"], d)
        self.cf.insert("key1", {"date": d})
        self._compare_dates(self.cf.get("key1")["date"], d)
        self.cf.remove("key1")
开发者ID:robingustafsson,项目名称:pycassa,代码行数:25,代码来源:test_autopacking.py

示例14: Remove

# 需要导入模块: from pycassa.columnfamily import ColumnFamily [as 别名]
# 或者: from pycassa.columnfamily.ColumnFamily import remove [as 别名]
def Remove(pool, columnFamily, key, val,*args, **kwargs):
    col_fam = ColumnFamily(pool, columnFamily)
    d = col_fam.remove(key, columns=val,*args, **kwargs)
开发者ID:wangbokun,项目名称:sms_send,代码行数:5,代码来源:cassandraoperator.py

示例15: remove_row

# 需要导入模块: from pycassa.columnfamily import ColumnFamily [as 别名]
# 或者: from pycassa.columnfamily.ColumnFamily import remove [as 别名]
def remove_row(columnFamily, uid) :
	"To remove row from a column family"
	column = ColumnFamily(pool, columnFamily)
	column.remove(uid)
开发者ID:redjohn19,项目名称:CloudMajor,代码行数:6,代码来源:operations.py


注:本文中的pycassa.columnfamily.ColumnFamily.remove方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。