The GoogleKey used by OpenBD is exactly the same key used by the GAE
datastore. We store/display the URL-safe string version rather than storing
it as an object; that's all.

Vince

On Mon, Nov 23, 2009 at 4:01 AM, Bassil Karam <[email protected]> wrote:

> Vince what are you thoughts on the potential confusion with the custom
> GoogleKey in OpenBD and the real Key in app engine? Why not just use kind
> and key as the identifier rather than a superfluous GoogleKey?
>
> Baz
>
>
> On Mon, Nov 16, 2009 at 11:34 PM, Rainer Schreiber <
> [email protected]> wrote:
>
>> Baz, let me respond to you this afternoon, when I am back home from my
>> daily work.
>>
>> 2009/11/17 Bassil Karam <[email protected]>
>>
>> Rainer, is the datastore key populated somewhere in the cfc after you
>>> write (NOT the openbd googlekey)? I'm only asking because I'm not somewhere
>>> where I can test it myself.
>>>
>>> Baz
>>>
>>>
>>> On Mon, Nov 16, 2009 at 3:08 PM, Bassil Karam <[email protected]> wrote:
>>>
>>>> To add, the statement User.googleRead(2) would actually just be a
>>>> shortcut for:
>>>>
>>>> User.setGoogleKey(2);
>>>> User.googleRead(); // which automatically finds and uses the "GoogleKey"
>>>> property of a cfc
>>>>
>>>> Similarly the User.googleWrite(1) function would be a shortcut for:
>>>>
>>>> User.setGoogleKey(1);
>>>> User.googleWrite();
>>>>
>>>> Baz
>>>>
>>>>
>>>> On Mon, Nov 16, 2009 at 3:01 PM, Bassil Karam <[email protected]> wrote:
>>>>
>>>>> Rainer, so I see what you mean now. I never noticed there were 2 keys,
>>>>> but reading over the docs I now see:
>>>>>
>>>>>   googleKey value returned from GoogleWrite(). If used, then kind and
>>>>> keyName must not be used. kind If used, then googleKey must not be
>>>>> used. kind is used by this function together with keyName to create a
>>>>> googleKey that is then used to read the entity from the datastore.
>>>>> keyName If used, then googleKey must not be used. keyName is used by
>>>>> this function together with kind to create a googleKey that is then used 
>>>>> to
>>>>> read the entity from the datastore.
>>>>>
>>>>> So "googleKey" is an OpenBD-specific key that gets returned from
>>>>> googleWrite() whereas "keyName" is the actual id of the kind as the 
>>>>> datstore
>>>>> sees it. I have a feeling the googleKey is basically hash(kind && keyName)
>>>>> to make a single uniquely identifiable key that in independent of kind.
>>>>>
>>>>> Now for the question of whether this is *good* or not :)
>>>>>
>>>>> For one it seems certain that it shouldn't be called "googleKey", as
>>>>> that is quite misleading, but rather something much closer to
>>>>> "OpenBD-Specific-Key". I guess the main problem it is trying to solve is 
>>>>> to
>>>>> be able to interact with records without having to specify 2 values ("key"
>>>>> and "kind") - this is probably especially useful when doing a batch read
>>>>> using an array of keys, which is much simpler than an array of structs 
>>>>> with
>>>>> "key" and "kind".
>>>>>
>>>>> Given all that though, I think I agree with your criticisms Rainer -
>>>>> seems to add more confusion and complexity than it solves. In the world of
>>>>> relational db's, you need to know the id AND table name, so people are 
>>>>> used
>>>>> to dealing with both pieces of data. With regards to batch reads, might be
>>>>> ok to limit that to one kind. So when you provide an array of keys, you 
>>>>> know
>>>>> it is for a single kind. And for a super-advanced version you can provide 
>>>>> an
>>>>> array of structs with kind/key.
>>>>>
>>>>> To me, this seems like the most natural flow:
>>>>>
>>>>> *dataset for kind USER*
>>>>> key = 1, name = baz,    coolness = high
>>>>> key = 2, name = rainer, coolness = almost-as-high
>>>>>
>>>>> *read*
>>>>> User.googleRead(2) // reads user "rainer" at key #2
>>>>> User.googleRead(2, 'User') // same as above except "kind" is explicitly
>>>>> specified
>>>>> Key = googleRead('User', 2) // "key" and "kind" are required when using
>>>>> the general googleRead() function
>>>>>
>>>>> *write*
>>>>> User.googleWrite() // writes the "rainer" object that was read in
>>>>> previous statements, no key necessary as it is stored as a property of the
>>>>> cfc
>>>>> User.googleWrite(1) // overwrites the "baz" record at key #1 with the
>>>>> "rainier" record because the key was manually specified. (The resulting
>>>>> recordset would have 2 identical records except with key #1 and #2)
>>>>>
>>>>> googleWrite(User) // only cfc is required when using general
>>>>> googleWrite(), the key is stored in the cfc
>>>>>
>>>>> Seems simpler this way, without any roadblocks - thoughts?
>>>>>
>>>>> Baz
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>  On Mon, Nov 16, 2009 at 1:54 PM, Rainer <[email protected]>wrote:
>>>>>
>>>>>>
>>>>>> If I run the following code:
>>>>>>
>>>>>>
>>>>>> ---------------------------------------------------------------------------------
>>>>>> <cfset local.myCountry = CreateObject
>>>>>> ("component","model.country.Country").init
>>>>>>
>>>>>> (countryCode="DE",tld="de",googleAnalyticsAccountNr="UA-8664183-3",verifyV1="yYX5DacOjdbms/
>>>>>> rvqM9jhPpwLMHVuaFUf53eUGCu1pw=") />
>>>>>> <cfset local.myGoogleKey = GoogleWrite(local.myCountry,"Country") />
>>>>>> Generated GoogleKey = #local.myGoogleKey#<br>
>>>>>>
>>>>>> <cfset aCountries = GoogleQuery('select from Country') />
>>>>>> Number of Country objects in datastore = #ArrayLen(aCountries)#<br>
>>>>>>
>>>>>> <cfset local.myCountry2 = CreateObject
>>>>>> ("component","model.country.Country").init
>>>>>>
>>>>>> (countryCode="GE",tld="ge",googleAnalyticsAccountNr="RR-8664183-3",verifyV1="aaX5DacOjdbms/
>>>>>> rvqM9jhPpwLMHVuaFUf53eUGCu1pw=") />
>>>>>> <cfset local.myGoogleKey2 = GoogleWrite
>>>>>> (local.myCountry2,"Country",local.myGoogleKey) />
>>>>>> Generated GoogleKey2 = #local.myGoogleKey2#<br>
>>>>>>
>>>>>> <cfset aCountries2 = GoogleQuery('select from Country') />
>>>>>> Number of Country objects in datastore = #ArrayLen(aCountries2)#<br>
>>>>>>
>>>>>> ---------------------------------------------------------------------------------
>>>>>>
>>>>>>
>>>>>> I get the following result:
>>>>>>
>>>>>>
>>>>>>
>>>>>> ---------------------------------------------------------------------------------
>>>>>> Generated GoogleKey = agZvd296em9yDgsSB2NvdW50cnkY4gEM
>>>>>> Number of Country objects in datastore = 1
>>>>>> Generated GoogleKey2 =
>>>>>>
>>>>>> agZvd296em9yLQsSB2NvdW50cnkiIGFnenZkMjk2ZW05eWRnc3NiMm52ZHc1MGNua3k0Z2VtDA
>>>>>> Number of Country objects in datastore = 2
>>>>>>
>>>>>> ---------------------------------------------------------------------------------
>>>>>>
>>>>>>
>>>>>>
>>>>>> On Nov 16, 10:42 pm, Rainer Schreiber <[email protected]>
>>>>>> wrote:
>>>>>> > I get a key like 'agZvd296em9yDgsSB2NvdW50cnkYzQEM'
>>>>>> >
>>>>>> > 2009/11/16 Bassil Karam <[email protected]>
>>>>>> >
>>>>>> > > Rainer,
>>>>>> >
>>>>>> > > What do you get for GoogleKey when you do 'GoogleKey =
>>>>>> > > GoogleWrite (myObj,myKind)'?
>>>>>> >
>>>>>> > > Baz
>>>>>> >
>>>>>>  > > On Mon, Nov 16, 2009 at 1:13 PM, Rainer <
>>>>>> [email protected]> wrote:
>>>>>> >
>>>>>> > >> Good point Baz:
>>>>>> > >> At the moment I use GoogleWrite(MyObj,getMetaData
>>>>>> > >> (MyObj).name,'MyKey123'). Why must I give the name of my object
>>>>>> as an
>>>>>> > >> argument, when the function GoogleWrite should be able to fetch
>>>>>> it
>>>>>> > >> itselve from the first argument MyObj?
>>>>>> >
>>>>>> > >> I furthermore must recall my latest blog here: keyName NOT EQUALS
>>>>>> > >> googleKey!!! I still think that the implementation of the unique
>>>>>> keys
>>>>>> > >> of objects in the datastore is confusing!
>>>>>> >
>>>>>> > >> First of all, you can NOT use the 'GoogleKey' which is generated
>>>>>> by
>>>>>> > >> the function 'GoogleWrite'. If you try 'GoogleKey = GoogleWrite
>>>>>> > >> (myObj,myKind)' and in a next request you use the GoogleKey to do
>>>>>> an
>>>>>> > >> update like 'GoogleKey2 = GoogleWrite(myObj,myKind,GoogleKey)',
>>>>>> there
>>>>>> > >> will be 2 objects in the datastore, and 'GoogleKey2' NOT equals
>>>>>> > >> 'GoogleKey'!
>>>>>> >
>>>>>> > >> Secondly, if you generate a unique key yourselve (f.i.
>>>>>> myUniqueKey =
>>>>>> > >> CreateUUID()), you must store this unique key as a property in
>>>>>> your
>>>>>> > >> object in order to be able to update this object in the
>>>>>> datastore. Let
>>>>>> > >> me explain: I save a new object to the datastore with
>>>>>> 'GoogleWrite
>>>>>> > >> (myObj,myKind,myUniqueKey)'. In a next request, I must read
>>>>>> > >> myUniqueKey from a (listed) object, in order to be able to update
>>>>>> the
>>>>>> > >> object in the datastore by doing a 'GoogleWrite
>>>>>> > >> (myObj,myKind,myUniqueKey)'. I think that's really stupid, if
>>>>>> there's
>>>>>> > >> already a GoogleKey!
>>>>>> >
>>>>>> > >> And now I am back at my first point, that you can NOT use the
>>>>>> > >> GoogleKey!
>>>>>> >
>>>>>> > >> So, what I am trying to say is that the idea of having a
>>>>>> GoogleKey is
>>>>>> > >> really great, because you would not have to store a unique key in
>>>>>> your
>>>>>> > >> object. But that only works if you can first do a GoogleKey =
>>>>>> > >> GoogleWrite(myObj) and than later on use this GoogleKey to do a
>>>>>> > >> GoogleWrite(myObj,GoogleKey), and NOT
>>>>>> GoogleWrite(myObj,keyName)!!
>>>>>> >
>>>>>> > >> Vince, could you please respond to this post and let me know what
>>>>>> you
>>>>>> > >> think, I would really appreciate that.
>>>>>> >
>>>>>> > >> Cheers,
>>>>>> >
>>>>>> > >> Rainer.
>>>>>> >
>>>>>> > >> On Nov 16, 8:55 pm, Bassil Karam <[email protected]> wrote:
>>>>>> > >> > My pleasure :)
>>>>>> >
>>>>>> > >> > One suggestion I would make to Vince is to reverse the
>>>>>> positions of the
>>>>>> > >> > attributes "kind" and "keyName" and to not make "kind" required
>>>>>> if
>>>>>> > >> "keyName"
>>>>>> > >> > is specified. For example, if I wanted to save an object, I
>>>>>> could do:
>>>>>> >
>>>>>> > >> > googleWrite(MyObj);
>>>>>> >
>>>>>> > >> > This will automatically populate the kind and the keyName, but
>>>>>> if I had
>>>>>> > >> my
>>>>>> > >> > own key name, it seems I should be able to simply provide it:
>>>>>> >
>>>>>> > >> > googleWrite(MyObj, 'MyKeyName');
>>>>>> >
>>>>>> > >> > With the "kind" automatically populated as before. Why should I
>>>>>> have to
>>>>>> > >> now
>>>>>> > >> > specify it just because I have a key?
>>>>>> >
>>>>>> > >> > Similarly if you invoke googleWrite on the component itself:
>>>>>> >
>>>>>> > >> > MyObj.googleWrite('MyKeyName')
>>>>>> >
>>>>>> > >> > I think keyname is going to be specified MUCH more often than
>>>>>> kind and
>>>>>> > >> > should therefore precede kind in the attribute list and also
>>>>>> not be tied
>>>>>> > >> to
>>>>>> > >> > it.
>>>>>> >
>>>>>> > >> > Just some thoughts,
>>>>>> > >> > Baz
>>>>>> >
>>>>>> > >> > On Mon, Nov 16, 2009 at 11:17 AM, Rainer <
>>>>>> [email protected]>
>>>>>> > >> wrote:
>>>>>> >
>>>>>> > >> > > Thanks Baz, that one helped me out.
>>>>>> >
>>>>>> > >> > > I didn't get it into my grey cells that keyName = googleKey.
>>>>>> Of
>>>>>> > >> > > course, it's not a problem to use a kind, but I didn't know
>>>>>> that you
>>>>>> > >> > > can use a GoogleKey as a KeyName to update an object with
>>>>>> GoogleWrite.
>>>>>> >
>>>>>> > >> > > Great, let's put my model together this night!
>>>>>> >
>>>>>> > >> > > Thanks again Baz.
>>>>>> >
>>>>>> > >> > > Rainer.
>>>>>> >
>>>>>> > >> > > On Nov 16, 6:25 pm, Bassil Karam <[email protected]> wrote:
>>>>>> > >> > > > Rainer,
>>>>>> >
>>>>>> > >> > > > For your first question you say that you have the google
>>>>>> key in a
>>>>>> > >> hidden
>>>>>> > >> > > > form field. So that means you can do:
>>>>>> >
>>>>>> > >> > > > googleWrite(MyCFC, 'MyKind', 'MyKey123');
>>>>>> >
>>>>>> > >> > > > What's the trouble? Is it that you would prefer to do
>>>>>> something
>>>>>> > >> like:
>>>>>> >
>>>>>> > >> > > > MyCFC.setGoogleKey('MyKey123');
>>>>>> > >> > > > MyCFC.googleWrite();
>>>>>> >
>>>>>> > >> > > > So that you don't have to specify a kind?
>>>>>> >
>>>>>> > >> > > > Baz
>>>>>> >
>>>>>> > >> > > > On Mon, Nov 16, 2009 at 1:27 AM, Rainer <
>>>>>> [email protected]>
>>>>>> > >> > > wrote:
>>>>>> >
>>>>>> > >> > > > > Sorry for my mistake...
>>>>>> > >> > > > > In my option 2) I know, that I can update an object with
>>>>>> > >> GoogleWrite
>>>>>> > >> > > > > (kind,keyName), so that's not my question there.
>>>>>> > >> > > > > My question in option 2) is:
>>>>>> > >> > > > > How do I get the kind and Keyname when I do a listing?
>>>>>> > >> > > > > - aUsers = GoogleQuery('select from User');
>>>>>> > >> > > > > - loop over aUsers
>>>>>> > >> > > > > - have an User object, can I do than a User.getKind() and
>>>>>> > >> > > > > User.getKeyName()?
>>>>>> >
>>>>>> > >> > > > > Rainer.
>>>>>> >
>>>>>> > >> > > > > On 16 nov, 10:18, Rainer <[email protected]>
>>>>>> wrote:
>>>>>> > >> > > > > > Vince,
>>>>>> >
>>>>>> > >> > > > > > Coul you please clarify me on this subject, I don't get
>>>>>> 'the
>>>>>> > >> circle
>>>>>> > >> > > > > > closed'.
>>>>>> >
>>>>>> > >> > > > > > When I follow the documentation athttp://
>>>>>> > >> > > > >
>>>>>> wiki.openbluedragon.org/wiki/index.php/GoogleAppEngine:Datastore,
>>>>>> > >> > > > > > I can't seem to make a closing structure of my logic.
>>>>>> >
>>>>>> > >> > > > > > 1) When I choose to go for the googleKey (which I higly
>>>>>> prefer,
>>>>>> > >> > > > > > because it's generated by the datastore), I do the
>>>>>> following:
>>>>>> > >> > > > > > - create an object from my User.cfc (bean); User =
>>>>>> CreateObject
>>>>>> > >> > > > > > ('component','model.user.User').init()
>>>>>> > >> > > > > > - write it to the datastore; googleKey =
>>>>>> GoogleWrite(User);
>>>>>> > >> > > > > > - read from the datastore; User =
>>>>>> googleRead(googleKey);
>>>>>> > >> > > > > > - get list of users; aUsers = GoogleQuery('select from
>>>>>> User')
>>>>>> > >> > > > > > But what if I have a the details of a user in a form
>>>>>> (with the
>>>>>> > >> > > > > > googleKey in a hidden input), and I post this form.
>>>>>> > >> > > > > > How do I than create a User object that 'knows' the
>>>>>> googleKey so
>>>>>> > >> that
>>>>>> > >> > > > > > a GoogleWrite() will update an exisiting object in the
>>>>>> > >> datastore?
>>>>>> > >> > > > > > Should I first do a 'User = googleRead(googleKey)' and
>>>>>> than
>>>>>> > >> update
>>>>>> > >> > > the
>>>>>> > >> > > > > > properties with my form properties, and than
>>>>>> > >> 'GoogleWrite(User)'?
>>>>>> > >> > > > > > Or can I set the googleKey in my User object with a
>>>>>> > >> 'setGoogleKey()'
>>>>>> > >> > > > > > function, or something like that?
>>>>>> >
>>>>>> > >> > > > > > 2) When I choose to go for the combination
>>>>>> kind/keyName, I do
>>>>>> > >> the
>>>>>> > >> > > > > > following:
>>>>>> > >> > > > > > - create an object from my User.cfc (bean); User =
>>>>>> CreateObject
>>>>>> > >> > > > > > ('component','model.user.User').init(kind,keyName)
>>>>>> > >> > > > > > - write it to the datastore;
>>>>>> GoogleWrite(User,kind,keyName);
>>>>>> > >> > > > > > - read from the datastore; User =
>>>>>> googleRead(kind,keyName);
>>>>>> > >> > > > > > - get list of users; aUsers = GoogleQuery('select from
>>>>>> User');
>>>>>> > >> > > > > > But what if I have a the details of a user in a form
>>>>>> (with the
>>>>>> > >> kind
>>>>>> > >> > > > > > and keyName in a hidden input), and I post this form.
>>>>>> > >> > > > > > How do I than create a User object that 'knows' the the
>>>>>> kind and
>>>>>> > >> > > > > > keyName so that a GoogleWrite() will update an
>>>>>> exisiting object
>>>>>> > >> in
>>>>>> > >> > > the
>>>>>> > >> > > > > > datastore? Should I first do a 'User =
>>>>>> googleRead(kind,keyName)'
>>>>>> > >> and
>>>>>> > >> > > > > > than update the properties with my form properties, and
>>>>>> than
>>>>>> > >> > > > > > 'GoogleWrite(User)'?
>>>>>> > >> > > > > > Or can I set the kind and keyName in my User object
>>>>>> with
>>>>>> > >> > > 'setGoogleKind
>>>>>> > >> > > > > > () and setGoogleKeyName()' functions, or something like
>>>>>> that?
>>>>>> >
>>>>>> > >> > > > > > Maybe, I am overseeing something very badly, but after
>>>>>> read the
>>>>>> > >> doc a
>>>>>> > >> > > > > > couple of time, and trying some different code, I coul
>>>>>> not come
>>>>>> > >> up
>>>>>> > >> > > > > > with a solution.
>>>>>> >
>>>>>> > >> > > > > > Thank you in advance for helping me out,
>>>>>> >
>>>>>> > >> > > > > > Rainer.
>>>>>> >
>>>>>> > >> > > > > > On 14 nov, 10:52, Rainer <[email protected]>
>>>>>> wrote:
>>>>>> >
>>>>>> > >> > > > > > > Great! ... but, how do I know when I try to insert a
>>>>>> new
>>>>>> > >> object
>>>>>> > >> > > what
>>>>>> > >> > > > > > > the new int (max int + 1) is for this specific
>>>>>> object's
>>>>>> > >> keyName?
>>>>>> >
>>>>>> > >> > > > > > > And if I start using a UUID, is it unique enough to
>>>>>> be sure it
>>>>>> > >> was
>>>>>> > >> > > not
>>>>>> > >> > > > > > > used before in a save action to the datastore?
>>>>>> >
>>>>>> > >> > > > > > > Questions... questions...
>>>>>> >
>>>>>> > >> > > > > > > Rainer.
>>>>>> >
>>>>>> > >> > > > > > > On Nov 14, 2:01 am, Bassil Karam <[email protected]>
>>>>>> wrote:
>>>>>> >
>>>>>> > >> > > > > > > > I think I read somewhere that an int works a lot
>>>>>> faster on
>>>>>> > >> gae,
>>>>>> > >> > > but I
>>>>>> > >> > > > > could
>>>>>> > >> > > > > > > > be completely mistaken. Anyone know? But otherwise,
>>>>>> yeah: )
>>>>>> >
>>>>>> > >> > > > > > > > On Nov 13, 2009 4:54 PM, "Rainer" <
>>>>>> [email protected]
>>>>>> >
>>>>>> > >> > > wrote:
>>>>>> >
>>>>>> > >> > > > > > > > Okay, so I don't rely on googleKey, but instead, I
>>>>>> create my
>>>>>> > >> own
>>>>>> > >> > > > > > > > unique key, like maybe a UUID ?!
>>>>>> >
>>>>>> > >> > > > > > > > On Nov 14, 1:43 am, Bassil Karam <
>>>>>> [email protected]>
>>>>>> > >> wrote: >
>>>>>> > >> > > Hey
>>>>>> > >> > > > > Rainer,
>>>>>> > >> > > > > > > > you don't need to read f...
>>>>>> >
>>>>>> > >> > > > > > > > > On Fri, Nov 13, 2009 at 4:14 PM, Rainer <
>>>>>> > >> > > [email protected]>
>>>>>> > >> > > > > wrote:
>>>>>> > >> > > > > > > > > > > Guys, > > > Maybe ...- Tekst uit
>>>>>> oorspronkelijk
>>>>>> > >> bericht
>>>>>> > >> > > niet
>>>>>> > >> > > > > weergeven -
>>>>>> >
>>>>>> > >> > > > > > > - Tekst uit oorspronkelijk bericht weergeven -- Tekst
>>>>>> uit
>>>>>> > >> > > > > oorspronkelijk bericht niet weergeven -
>>>>>> >
>>>>>> > >> > > > > > - Tekst uit oorspronkelijk bericht weergeven -
>>>>>> >
>>>>>> >
>>>>>>
>>>>>>
>>>>>
>>>>
>>>
>>> --~--~---------~--~----~------------~-------~--~----~
>>> Open BlueDragon Public Mailing List
>>>  http://www.openbluedragon.org/   http://twitter.com/OpenBlueDragon
>>>  mailing list - http://groups.google.com/group/openbd?hl=en
>>>
>>>  !! save a network - please trim replies before posting !!
>>>
>>> -~----------~----~----~----~------~----~------~--~---
>>>
>>>
>>  --
>> Open BlueDragon Public Mailing List
>> http://www.openbluedragon.org/ http://twitter.com/OpenBlueDragon
>> mailing list - http://groups.google.com/group/openbd?hl=en
>>
>> !! save a network - please trim replies before posting !!
>>
>
>  --
> Open BlueDragon Public Mailing List
> http://www.openbluedragon.org/ http://twitter.com/OpenBlueDragon
> mailing list - http://groups.google.com/group/openbd?hl=en
>
> !! save a network - please trim replies before posting !!
>

-- 
Open BlueDragon Public Mailing List
 http://www.openbluedragon.org/   http://twitter.com/OpenBlueDragon
 mailing list - http://groups.google.com/group/openbd?hl=en

 !! save a network - please trim replies before posting !!

Reply via email to