2012-08-07 90 views
2

我正在檢查WTF超級列,並且試圖使表格成爲例子。 什麼都沒有出現。如果格式如此,我很好奇如何創建表格。如何在Cassandra中創建表格

AddressBook = { // this is a ColumnFamily of type Super 
        phatduckk: { // this is the key to this row inside the Super CF 
        // the key here is the name of the owner of the address book 

        // now we have an infinite # of super columns in this row 
        // the keys inside the row are the names for the SuperColumns 
        // each of these SuperColumns is an address book entry 
        friend1: {street: "8th street", zip: "90210", city: "Beverley Hills", state: "CA"}, 

    // this is the address book entry for John in phatduckk's address book 
        John: {street: "Howard street", zip: "94404", city: "FC", state: "CA"}, 
        Kim: {street: "X street", zip: "87876", city: "Balls", state: "VA"}, 
        Tod: {street: "Jerry street", zip: "54556", city: "Cartoon", state: "CO"}, 
        Bob: {street: "Q Blvd", zip: "24252", city: "Nowhere", state: "MN"}, 
    ... 
    // we can have an infinite # of ScuperColumns (aka address book entries) 
        }, // end row 
    // all the address book entries for ieure 
         ieure: {  // this is the key to another row in the Super CF 
           joey: {street: "A ave", zip: "55485", city: "Hell", state: "NV"}, 
         William: {street: "Armpit Dr", zip: "93301", city: "Bakersfield", state: "CA"}, 
}, 

}

我相信我有創建列家庭和超列族。 預先感謝您。

回答

0

不要使用超級柱,因爲它們已被棄用。相反,使用複合列如下:

AddressBook { 
    User1 { 
     Friend1:street : "some st" 
     Friend1:zip : 30000 
     Friend1:city : "mayberry" 
     Friend1:state : "ST" 
     Friend2:street : "some other st" 
     Friend2:zip : 30001 
     Friend2:city : "springfield" 
     Friend2:state : "ST" 
    }, 
    User2 { 
     ... 
    } 
}