You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@cassandra.apache.org by Tamar Fraenkel <ta...@tok-media.com> on 2012/03/11 09:50:39 UTC

data model question

Hi!
I need some advise:
I have user CF, which has a UUID key which is my internal user id.
One of the column is facebook_id of the user (if exist).

I need to have the reverse mapping from facebook_id to my UUID.
My intention is to add a CF for the mapping from Facebook Id to my id:

user_by_fbid = {
  // key is fb Id, column name is our User Id, value is empty
  100003101876963: {
    f94f6b20-161a-4f7e-995f-0466c62a1b6b : ""
  }
}

Does this makes sense.
This CF will be used whenever a user log in through Facebook to retrieve
the internal id.
Thanks

*Tamar Fraenkel *
Senior Software Engineer, TOK Media

[image: Inline image 1]

tamar@tok-media.com
Tel:   +972 2 6409736
Mob:  +972 54 8356490
Fax:   +972 2 5612956

Re: data model question

Posted by Tamar Fraenkel <ta...@tok-media.com>.
Thanks!
Better than mine, as it considered later additions of services!
Will update my code,
Thanks

*Tamar Fraenkel *
Senior Software Engineer, TOK Media

[image: Inline image 1]

tamar@tok-media.com
Tel:   +972 2 6409736
Mob:  +972 54 8356490
Fax:   +972 2 5612956





On Mon, Mar 12, 2012 at 11:13 AM, aaron morton <aa...@thelastpickle.com>wrote:

> In this case, where you know the query upfront, I add a custom secondary
> index using another CF to support the query. It's a little easier here
> because the data wont change.
>
> UserLookupCF (using composite types for the key value)
>
> row_key: <system_name:id> e.g. "facebook:12345" or "twitter:12345"
> col_name : <internal_user_id> e.g. "5678"
> col_value: empty
>
> Hope that helps.
>
>   -----------------
> Aaron Morton
> Freelance Developer
> @aaronmorton
> http://www.thelastpickle.com
>
> On 11/03/2012, at 11:15 PM, Tamar Fraenkel wrote:
>
> Hi!
> Thanks for the response.
> From what I read, secondary indices are good only for columns with few
> possible values. Is this a good fit for my case? I have unique facebook id
> for every user.
> Thanks
>
> *Tamar Fraenkel *
> Senior Software Engineer, TOK Media
>
> <tokLogo.png>
>
> tamar@tok-media.com
> Tel:   +972 2 6409736
> Mob:  +972 54 8356490
> Fax:   +972 2 5612956
>
>
>
>
>
> On Sun, Mar 11, 2012 at 11:48 AM, Marcel Steinbach <ms...@gmail.com>wrote:
>
>> Either you do that or you could think about using a secondary index on
>> the fb user name in your primary cf.
>>
>> See http://www.datastax.com/docs/1.0/ddl/indexes
>>
>> Cheers
>>
>> Am 11.03.2012 um 09:51 schrieb Tamar Fraenkel <ta...@tok-media.com>:
>>
>>  Hi!
>> I need some advise:
>> I have user CF, which has a UUID key which is my internal user id.
>> One of the column is facebook_id of the user (if exist).
>>
>> I need to have the reverse mapping from facebook_id to my UUID.
>> My intention is to add a CF for the mapping from Facebook Id to my id:
>>
>> user_by_fbid = {
>>   // key is fb Id, column name is our User Id, value is empty
>>   100003101876963: {
>>     f94f6b20-161a-4f7e-995f-0466c62a1b6b : ""
>>   }
>> }
>>
>> Does this makes sense.
>> This CF will be used whenever a user log in through Facebook to retrieve
>> the internal id.
>> Thanks
>>
>> *Tamar Fraenkel *
>> Senior Software Engineer, TOK Media
>>
>> <tokLogo.png>
>>
>>
>> tamar@tok-media.com
>> Tel:   +972 2 6409736
>> Mob:  +972 54 8356490
>> Fax:   +972 2 5612956
>>
>>
>>
>>
>
>

Re: data model question

Posted by Sasha Dolgy <sd...@gmail.com>.
Alternate would be to add another row to your user CF specific for Facebook
ids.  Column ID would be the Facebook identifier and value would be your
internal uuid.

Consider when you want to add another service like twitter.  Will you then
add another CF per service or just another row specific now to twitter
ID's.  Queries will be easy still as its against a single row in the same
CF.
On Mar 12, 2012 10:14 AM, "aaron morton" <aa...@thelastpickle.com> wrote:

> In this case, where you know the query upfront, I add a custom secondary
> index using another CF to support the query. It's a little easier here
> because the data wont change.
>
> UserLookupCF (using composite types for the key value)
>
> row_key: <system_name:id> e.g. "facebook:12345" or "twitter:12345"
> col_name : <internal_user_id> e.g. "5678"
> col_value: empty
>
> Hope that helps.
>
> -----------------
> Aaron Morton
> Freelance Developer
> @aaronmorton
> http://www.thelastpickle.com
>
> On 11/03/2012, at 11:15 PM, Tamar Fraenkel wrote:
>
> Hi!
> Thanks for the response.
> From what I read, secondary indices are good only for columns with few
> possible values. Is this a good fit for my case? I have unique facebook id
> for every user.
> Thanks
>
> *Tamar Fraenkel *
> Senior Software Engineer, TOK Media
>
> <tokLogo.png>
>
> tamar@tok-media.com
> Tel:   +972 2 6409736
> Mob:  +972 54 8356490
> Fax:   +972 2 5612956
>
>
>
>
>
> On Sun, Mar 11, 2012 at 11:48 AM, Marcel Steinbach <ms...@gmail.com>wrote:
>
>> Either you do that or you could think about using a secondary index on
>> the fb user name in your primary cf.
>>
>> See http://www.datastax.com/docs/1.0/ddl/indexes
>>
>> Cheers
>>
>> Am 11.03.2012 um 09:51 schrieb Tamar Fraenkel <ta...@tok-media.com>:
>>
>>  Hi!
>> I need some advise:
>> I have user CF, which has a UUID key which is my internal user id.
>> One of the column is facebook_id of the user (if exist).
>>
>> I need to have the reverse mapping from facebook_id to my UUID.
>> My intention is to add a CF for the mapping from Facebook Id to my id:
>>
>> user_by_fbid = {
>>   // key is fb Id, column name is our User Id, value is empty
>>   100003101876963: {
>>     f94f6b20-161a-4f7e-995f-0466c62a1b6b : ""
>>   }
>> }
>>
>> Does this makes sense.
>> This CF will be used whenever a user log in through Facebook to retrieve
>> the internal id.
>> Thanks
>>
>> *Tamar Fraenkel *
>> Senior Software Engineer, TOK Media
>>
>> <tokLogo.png>
>>
>>
>> tamar@tok-media.com
>> Tel:   +972 2 6409736
>> Mob:  +972 54 8356490
>> Fax:   +972 2 5612956
>>
>>
>>
>>
>
>

Re: data model question

Posted by aaron morton <aa...@thelastpickle.com>.
In this case, where you know the query upfront, I add a custom secondary index using another CF to support the query. It's a little easier here because the data wont change.

UserLookupCF (using composite types for the key value)

row_key: <system_name:id> e.g. "facebook:12345" or "twitter:12345"
col_name : <internal_user_id> e.g. "5678"
col_value: empty

Hope that helps.

-----------------
Aaron Morton
Freelance Developer
@aaronmorton
http://www.thelastpickle.com

On 11/03/2012, at 11:15 PM, Tamar Fraenkel wrote:

> Hi!
> Thanks for the response.
> From what I read, secondary indices are good only for columns with few possible values. Is this a good fit for my case? I have unique facebook id for every user.
> Thanks
> 
> Tamar Fraenkel 
> Senior Software Engineer, TOK Media 
> 
> <tokLogo.png>
> 
> tamar@tok-media.com
> Tel:   +972 2 6409736 
> Mob:  +972 54 8356490 
> Fax:   +972 2 5612956 
> 
> 
> 
> 
> 
> On Sun, Mar 11, 2012 at 11:48 AM, Marcel Steinbach <ms...@gmail.com> wrote:
> Either you do that or you could think about using a secondary index on the fb user name in your primary cf. 
> 
> See http://www.datastax.com/docs/1.0/ddl/indexes
> 
> Cheers
> 
> Am 11.03.2012 um 09:51 schrieb Tamar Fraenkel <ta...@tok-media.com>:
> 
>> Hi!
>> I need some advise:
>> I have user CF, which has a UUID key which is my internal user id. 
>> One of the column is facebook_id of the user (if exist).
>> 
>> I need to have the reverse mapping from facebook_id to my UUID.
>> My intention is to add a CF for the mapping from Facebook Id to my id:
>> 
>> user_by_fbid = {
>>   // key is fb Id, column name is our User Id, value is empty
>>   100003101876963: {
>>     f94f6b20-161a-4f7e-995f-0466c62a1b6b : ""
>>   }
>> }
>> 
>> Does this makes sense.
>> This CF will be used whenever a user log in through Facebook to retrieve the internal id.
>> Thanks
>> 
>> Tamar Fraenkel 
>> Senior Software Engineer, TOK Media 
>> 
>> <tokLogo.png>
>> 
>> 
>> tamar@tok-media.com
>> Tel:   +972 2 6409736 
>> Mob:  +972 54 8356490 
>> Fax:   +972 2 5612956 
>> 
>> 
>> 
> 


Re: data model question

Posted by Tamar Fraenkel <ta...@tok-media.com>.
Hi!
Thanks for the response.
>From what I read, secondary indices are good only for columns with few
possible values. Is this a good fit for my case? I have unique facebook id
for every user.
Thanks

*Tamar Fraenkel *
Senior Software Engineer, TOK Media

[image: Inline image 1]

tamar@tok-media.com
Tel:   +972 2 6409736
Mob:  +972 54 8356490
Fax:   +972 2 5612956





On Sun, Mar 11, 2012 at 11:48 AM, Marcel Steinbach <ms...@gmail.com>wrote:

> Either you do that or you could think about using a secondary index on the
> fb user name in your primary cf.
>
> See http://www.datastax.com/docs/1.0/ddl/indexes
>
> Cheers
>
> Am 11.03.2012 um 09:51 schrieb Tamar Fraenkel <ta...@tok-media.com>:
>
>  Hi!
> I need some advise:
> I have user CF, which has a UUID key which is my internal user id.
> One of the column is facebook_id of the user (if exist).
>
> I need to have the reverse mapping from facebook_id to my UUID.
> My intention is to add a CF for the mapping from Facebook Id to my id:
>
> user_by_fbid = {
>   // key is fb Id, column name is our User Id, value is empty
>   100003101876963: {
>     f94f6b20-161a-4f7e-995f-0466c62a1b6b : ""
>   }
> }
>
> Does this makes sense.
> This CF will be used whenever a user log in through Facebook to retrieve
> the internal id.
> Thanks
>
> *Tamar Fraenkel *
> Senior Software Engineer, TOK Media
>
> <tokLogo.png>
>
>
> tamar@tok-media.com
> Tel:   +972 2 6409736
> Mob:  +972 54 8356490
> Fax:   +972 2 5612956
>
>
>
>

Re: data model question

Posted by Marcel Steinbach <ms...@gmail.com>.
Either you do that or you could think about using a secondary index on the
fb user name in your primary cf.

See http://www.datastax.com/docs/1.0/ddl/indexes

Cheers

Am 11.03.2012 um 09:51 schrieb Tamar Fraenkel <ta...@tok-media.com>:

Hi!
I need some advise:
I have user CF, which has a UUID key which is my internal user id.
One of the column is facebook_id of the user (if exist).

I need to have the reverse mapping from facebook_id to my UUID.
My intention is to add a CF for the mapping from Facebook Id to my id:

user_by_fbid = {
  // key is fb Id, column name is our User Id, value is empty
  100003101876963: {
    f94f6b20-161a-4f7e-995f-0466c62a1b6b : ""
  }
}

Does this makes sense.
This CF will be used whenever a user log in through Facebook to retrieve
the internal id.
Thanks

*Tamar Fraenkel *
Senior Software Engineer, TOK Media

<tokLogo.png>

tamar@tok-media.com
Tel:   +972 2 6409736
Mob:  +972 54 8356490
Fax:   +972 2 5612956