我在我的 cassandra 集群中定义了以下表模式
CREATE TABLE users (
username text PRIMARY KEY,
creationdate bigint,
email text,
firstlogin boolean,
firstname text,
lastloggedin bigint,
lastname text,
lastprofileupdate bigint,
name text,
olduserid int,
profile frozen<profile_type>,
user_id uuid
和用户定义的类型,profile_type 如下...
CREATE TYPE profile_type (
birthdate timestamp,
gender text,
title text,
relationshipstatus text,
homecountry text,
currentcountry text,
timezone text,
profilepicture blob,
alternate_email text,
religion text,
interests list<text>,
cellphone text,
biography text
);
如何将此结构表示为 cqlengine 模型?我对用户定义的类型表示特别感兴趣,因为我没有看到任何列定义来表示这样的?然后我需要手动映射吗?到目前为止,我在 python 中有这个....
class User(Model):
username = columns.Text(primary_key=True)
firstname = columns.Text(required=True)
lastname = columns.Text(required=True)
email = columns.Text(required=True)
name = columns.Text(required=False)
olduserid = columns.Integer()
user_id = columns.UUID(default=uuid.uuid4)
creationdate = columns.BigInt()