2013-05-07 47 views
0

我願意做這些CLI命令的pycassa等價列類型:指定pycassa

CREATE COLUMN FAMILY users 
WITH comparator = UTF8Type 
AND key_validation_class=UTF8Type 
AND column_metadata = [ 
{column_name: full_name, validation_class: UTF8Type} 
{column_name: email, validation_class: UTF8Type} 
{column_name: state, validation_class: UTF8Type} 
{column_name: gender, validation_class: UTF8Type} 
{column_name: birth_year, validation_class: LongType} 
]; 

什麼是pycassa等價? 謝謝

回答

2

你可以試試這個。不知道很多關於Python客戶端,還是......

validators = {'full_name': UTF8_TYPE, 
       'email': UTF8_TYPE, 
       'state': UTF8_TYPE, 
       'gender': UTF8_TYPE, 
       'birth_year': LONG_TYPE} 
sys.create_column_family('TestKeyspace', 'TestCF', super=False, 
       comparator_type=UTF8Type, 
       key_validation_class=UTF8Type, 
       column_validation_classes=validators) 
+1

這是不是在我原來的問題,而是如何你是否定義了複合動態列,如(「name」,1234)作爲關鍵字? – nam 2013-05-13 14:42:11

0

爲了回答您的其他問題: key_validation_class = '的CompositeType(UTF8Type,UTF8Type)'