I understand that the Google AppEngine Data Store changed their default policy on how ID's are auto-generated.
We have application code that expects all ID's to be less than the maximum value for an Integer. In trying to create sample data using the dashboard ("Datastore Viewer"), there is a way to create Entities manually. However when I do this, there appears to be no place to manually set the ID, and the auto-generated ID is larger than the maximum Integer value.
Setting <auto-id-policy>legacy</auto-id-policy> in appengine-web.xml and re-deploying did not seem to help.
I understand when you create Entities programmatically, you can specify your own ID number. Is there any way to do this from the Dashboard, or at least use "legacy" auto-id generation?
No, the Datastore Viewer only allows auto-generated IDs. :(
Related
What is the best way to handle Datastore keys? Should they only be transferred in websafe format or can I use their Key Name? Websafe format is 2-3 times more the amount of characters i.e increasing the ingress/egress costs of Google App Engine. Is it the best and safest approach?
To identify an entity (assuming no ancestors) you just need the entity kind and the entity id/name. Often the context of your app makes it clear what the entity kind is so all you need to know to get the entity is the id/name.
So yes, you can pass only an id/name between backend and frontend, and I do it all the time.
If the name used to create the Key object is by itself websafe (for example if the key is created using a long or a UUID) then there is no need to use the websafe version. If however it is created using an unsafe name string e.g Key.create(Custom.class, "John Doe") then using key.getName() over http will cause problems and .toWebsafeString() is here for that exact purpose.
I need to check if a value has successfully uploaded to a table using C#. The table uses a hash and range. Currently I use a queryrequest->queryresponse->queryresult and then check if the result is null. However the problem with this is that the entire table entry (i.e. all fields) are passed back to the program. This is not sufficiently secure.
I have looked at AWS IAM access policies however I cannot seem to restrict 'getitem' to field level, only to table level.
Any suggestions as to how to have an IAM access policy that only allows users get the hash/range from a table?
I don't think that this is possible via IAM. However, one way to approximate it is to encrypt all fields except for the hash/range.
I'm building an client/server-app where I want to sync data. I'm thinking about including the largest key from the local client database in the query so the server can fetch all entities added after that entity (with key > largest_local_key).
Can I be sure that the Google App Engine always increase the ID of new entities?
Is that a good way to implement synchronization?
No, IDs do not increase monotonically.
Consider synchronizing based on a create/update timestamp.
I have a google app engine app where I would like to extend one of my Entity definitions. How would I ensure existent entity objects get the new fields properly initialized? Would the existent objects, the next time I query them, simply have default values? I'd like to add a StringListProperty.
If you add a new property to your model, existing entities will have the default value for it when you load them, if you supplied a default. They won't show up in queries for that value until you fetch them and store them again, though.
You will have to add the property to all of your existing entities, one by one.
You don't mention which language or API you are using. The exact details of the procedure will vary with your situation.
In general, the safest way to do this is to load up each entity with a API that doesn't validate your entities. In python, you can use Expando models. In java, you can use the low level datastore API. (trying this with JDO or JPA may not work) You now need to iterate through all existing entities. (try the new Mapper API to do this with relatively little fuss). For each entity, you will load it, add your new property, then put/save it back to the datastore. Now you can safely go back to a framework that validates your entities, like JDO or non-expando models.
This method applies to modifying the type of a property or deleting a property as well.
I am using Google App Engine with Google's JDO implementation to save an entity for which I wish to provide an URL that a user can navigate to to view information about that entity. The problem I have is that the key generating strategy IdGeneratorStrategy.IDENTITY produces very long keys while the INCREMENT and SEQUENCE strategies are not implemented. I was planning to use the key as part of the URL to link to the entity, however since the only option I have to create a system generated key would result in an unwieldy URL I'm looking for suggestions how how to create a manageable URL to link directly to an entity in my datastore.
Is there any other option other than to create and maintain my own id generator?
Don't use the whole key - just the ID field. You can construct a key from the model name and the ID.