在pycassa中指定列类型

kmbjn2e3  于 2021-06-15  发布在  Cassandra
关注(0)|答案(2)|浏览(358)

我想在pycassa中实现这些cli命令的等效性:

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}
];

皮卡萨的等价性是什么?谢谢

1szpjjfi

1szpjjfi1#

回答另一个问题:key\u validation\u class='compositetype(utf8type,utf8type)'

30byixjq

30byixjq2#

你可以试试这个。我对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)

相关问题