[google-appengine] Re: Deep entity groups and long key strings

2009-06-16 Thread Jeff Enderwick

worked great, thanks!

On Mon, Jun 15, 2009 at 9:10 AM, Nick Johnson
(Google) wrote:
> On Mon, Jun 15, 2009 at 5:04 PM, Jeff Enderwick 
> wrote:
>>
>> Thanks Nick.
>>
>> If I go down the path of building ID-based URLs in the manner you
>> suggest, will I likely have substantially shorter URLs than I would
>> with str(node.key())?
>
> If you know the model types involved (and thus don't need to include them in
> the URL), then the URL will be a _lot_ shorter. If you need to include the
> type names as well, it'll still be shorter, just not as much. It'll also be
> a lot easier to read.
>
> The str(node.key()) representation is simply the Key Protocol Buffer, base64
> encoded, so it's guaranteed to be longer than parts of it, not encoded.
>
> -Nick Johnson
>
>>
>>
>> Thanks,
>> Jeff
>>
>> On Mon, Jun 15, 2009 at 4:44 AM, Nick Johnson
>> (Google) wrote:
>> > Hi Jeff,
>> >
>> > You're correct that the only way to access a datastore entity is to
>> > provide
>> > the full path to it - the key is the entity's primary (and only) key. If
>> > you
>> > know the entity type of each entity in the heirarchy, though, you can
>> > extract the id of the entity in question and all its parents, and
>> > represent
>> > the ID as a delimiter-separated list of IDs, though - 1/2/3/4 - and
>> > regenerate the key yourself.
>> >
>> > -Nick Johnson
>> >
>> > On Sun, Jun 14, 2009 at 5:51 PM, Jeff Enderwick
>> > 
>> > wrote:
>> >>
>> >> I have possibly deep entity groups (think tree structure), but I want
>> >> a URL where the user can go to a specific node, like:
>> >>
>> >> http://viewnode/.
>> >>
>> >> I'd like to use db.get() to directly access the node rather than query
>> >> based on node-id.
>> >>
>> >> If I build the URL based on str(node.key()), then the strings can get
>> >> very big. Key.from_path() seems to want the entire path from the
>> >> parent. Is it really the case that the only way to get direct access
>> >> to an interior node in an entity group is provide the entire path to
>> >> that node?
>> >>
>> >> Thanks, Jeff
>> >>
>> >>
>> >
>> > >
>> >
>>
>>
>
>
> >
>

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To post to this group, send email to google-appengine@googlegroups.com
To unsubscribe from this group, send email to 
google-appengine+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/google-appengine?hl=en
-~--~~~~--~~--~--~---



[google-appengine] Re: Deep entity groups and long key strings

2009-06-15 Thread Nick Johnson (Google)
On Mon, Jun 15, 2009 at 5:04 PM, Jeff Enderwick wrote:

>
> Thanks Nick.
>
> If I go down the path of building ID-based URLs in the manner you
> suggest, will I likely have substantially shorter URLs than I would
> with str(node.key())?


If you know the model types involved (and thus don't need to include them in
the URL), then the URL will be a _lot_ shorter. If you need to include the
type names as well, it'll still be shorter, just not as much. It'll also be
a lot easier to read.

The str(node.key()) representation is simply the Key Protocol Buffer, base64
encoded, so it's guaranteed to be longer than parts of it, not encoded.

-Nick Johnson


>
> Thanks,
> Jeff
>
> On Mon, Jun 15, 2009 at 4:44 AM, Nick Johnson
> (Google) wrote:
> > Hi Jeff,
> >
> > You're correct that the only way to access a datastore entity is to
> provide
> > the full path to it - the key is the entity's primary (and only) key. If
> you
> > know the entity type of each entity in the heirarchy, though, you can
> > extract the id of the entity in question and all its parents, and
> represent
> > the ID as a delimiter-separated list of IDs, though - 1/2/3/4 - and
> > regenerate the key yourself.
> >
> > -Nick Johnson
> >
> > On Sun, Jun 14, 2009 at 5:51 PM, Jeff Enderwick <
> jeff.enderw...@gmail.com>
> > wrote:
> >>
> >> I have possibly deep entity groups (think tree structure), but I want
> >> a URL where the user can go to a specific node, like:
> >>
> >> http://viewnode/.
> >>
> >> I'd like to use db.get() to directly access the node rather than query
> >> based on node-id.
> >>
> >> If I build the URL based on str(node.key()), then the strings can get
> >> very big. Key.from_path() seems to want the entire path from the
> >> parent. Is it really the case that the only way to get direct access
> >> to an interior node in an entity group is provide the entire path to
> >> that node?
> >>
> >> Thanks, Jeff
> >>
> >>
> >
> > >
> >
>
> >
>

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To post to this group, send email to google-appengine@googlegroups.com
To unsubscribe from this group, send email to 
google-appengine+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/google-appengine?hl=en
-~--~~~~--~~--~--~---



[google-appengine] Re: Deep entity groups and long key strings

2009-06-15 Thread Jeff Enderwick

Thanks Nick.

If I go down the path of building ID-based URLs in the manner you
suggest, will I likely have substantially shorter URLs than I would
with str(node.key())?

Thanks,
Jeff

On Mon, Jun 15, 2009 at 4:44 AM, Nick Johnson
(Google) wrote:
> Hi Jeff,
>
> You're correct that the only way to access a datastore entity is to provide
> the full path to it - the key is the entity's primary (and only) key. If you
> know the entity type of each entity in the heirarchy, though, you can
> extract the id of the entity in question and all its parents, and represent
> the ID as a delimiter-separated list of IDs, though - 1/2/3/4 - and
> regenerate the key yourself.
>
> -Nick Johnson
>
> On Sun, Jun 14, 2009 at 5:51 PM, Jeff Enderwick 
> wrote:
>>
>> I have possibly deep entity groups (think tree structure), but I want
>> a URL where the user can go to a specific node, like:
>>
>> http://viewnode/.
>>
>> I'd like to use db.get() to directly access the node rather than query
>> based on node-id.
>>
>> If I build the URL based on str(node.key()), then the strings can get
>> very big. Key.from_path() seems to want the entire path from the
>> parent. Is it really the case that the only way to get direct access
>> to an interior node in an entity group is provide the entire path to
>> that node?
>>
>> Thanks, Jeff
>>
>>
>
> >
>

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To post to this group, send email to google-appengine@googlegroups.com
To unsubscribe from this group, send email to 
google-appengine+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/google-appengine?hl=en
-~--~~~~--~~--~--~---



[google-appengine] Re: Deep entity groups and long key strings

2009-06-15 Thread Nick Johnson (Google)
Hi Jeff,

You're correct that the only way to access a datastore entity is to provide
the full path to it - the key is the entity's primary (and only) key. If you
know the entity type of each entity in the heirarchy, though, you can
extract the id of the entity in question and all its parents, and represent
the ID as a delimiter-separated list of IDs, though - 1/2/3/4 - and
regenerate the key yourself.

-Nick Johnson

On Sun, Jun 14, 2009 at 5:51 PM, Jeff Enderwick wrote:

>
> I have possibly deep entity groups (think tree structure), but I want
> a URL where the user can go to a specific node, like:
>
> http://viewnode/.
>
> I'd like to use db.get() to directly access the node rather than query
> based on node-id.
>
> If I build the URL based on str(node.key()), then the strings can get
> very big. Key.from_path() seems to want the entire path from the
> parent. Is it really the case that the only way to get direct access
> to an interior node in an entity group is provide the entire path to
> that node?
>
> Thanks, Jeff
>
> >
>

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To post to this group, send email to google-appengine@googlegroups.com
To unsubscribe from this group, send email to 
google-appengine+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/google-appengine?hl=en
-~--~~~~--~~--~--~---