> I'd assumed that the length of a db.Model instance's db.Key().name() > was a constant plus a linear function of the depth the entity in its > entity group.]
As I wrote above, I should have said length of str(db.Key() instance). db.Key's __str__ definition on google/appengine/api/ datastore_types.py, line 404 says Unfortunately, this string encoding isn't particularly compact, and its length varies with the length of the path. If you want a shorter identifier and you know the kind and parent (if any) ahead of time, consider using just the entity's id or name. On Oct 15, 9:12 pm, Andy Freeman <[EMAIL PROTECTED]> wrote: > I'm not using entity groups (in this case) because the entity/db.Model > instance that I'm constructing doesn't have a reasonable ancestor. > There will be too many of them to put under any of the db.Model > instances that I'm using to build the key_name, let alone to put under > a single root. > > The db.Model instance that I'm creating will not be used to create > other keys. The other db.Model instances whose Keys() I want to use > to create the key_name are likewise either root entities or at a very > short depth in an entity dag. > > I'd assumed that the length of a db.Model instance's db.Key().name() > was a constant plus a linear function of the depth the entity in its > entity group. > > If my assumption is true, the key_names that I'm planning to construct > will have bounded length. If the db.Key() s constructed by the dev > environment are the same length as those in the production > environment, I should be able to figure out whether said bounded > length is less than the max length of a key_name. > > On Oct 15, 2:19 pm, "Marzia Niccolai" <[EMAIL PROTECTED]> wrote: > > > > > Hi Andy, > > > I believe there is a limit on key names of 500 bytes, but I can't seem to > > find it in the documentation. > > > I think the question I have is there a reason you are not using entity > > groups? When using entity groups you can use Key.from_path() to construct > > key objects from the ancestor > > path:http://code.google.com/appengine/docs/datastore/keyclass.html#Key_fro... > > > This way you don't need to build up longer and longer key names. > > > -Marzia > > > On Wed, Oct 15, 2008 at 2:03 PM, Andy Freeman <[EMAIL PROTECTED]> wrote: > > > > I'd like to construct a key_name (for get_or_insert) by concatenating > > > the name() s of a couple of db.Key s.- Hide quoted text - > > > - Show quoted text -- Hide quoted text - > > - Show quoted text - --~--~---------~--~----~------------~-------~--~----~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/google-appengine?hl=en -~----------~----~----~----~------~----~------~--~---