The problem with keys (and datastore portability)

Google App Engine, we need to have a talk about your datastore keys.

Your keys can have names but they cannot start with a number. Keys can also have IDs, which are numeric. We can read those, but can't set them.

When I put an entity into the datastore for the first time, you assign it a numeric ID. I'd love to be able to create an entity on a different instance with the same ID you've assigned it but I can't. I'd love to be able to create an entity with the same key that you've assigned it (again, on a separate instance -- say the local SDK or a different app), but I can't set keys directly.

The only option seems to be the most convoluted one: The only way to have lists of keys not break when data is restored to another instance is to (a) not use lists of type db.Key, i.e., ListProperty(db.Key) is out, and (b) always store your own id in a separate field (in other words, two puts per entity instead of one.)

Not good.

Ways you could make my life easier:

  1. Instead of setting a numeric ID, set the key_name automatically for new puts.
  2. Barring that, let us set IDs too

Otherwise, porting datastore entities over that use lists of keys is going to be a real bitch (references are easy to handle).

Dear App Engine, I know you're busy these days but I hope you're listening. Much thanks!

Your friend (even though you sometimes treat me cruel), Aral