0

What is the best approach to separate the data from the debug version and the live one?

The question and answers here describe how to separate the code logic: https://stackoverflow.com/a/8550105/129202

Still the datastore data is shared between all versions.

I imagine any of these:

  • some nice setting in the dashboard that would automatically separate all data between versions, so they are completely ignorant of each other. No changes needed in code, unless you expect versions to share data :-P
  • get version number in code and use that to "physically" organize data, ie putting all data in subfolders/subkeys per version... I'm not very experienced with the datastore yet and don't know if this would have a significant impact on performance.
Community
  • 1
  • 1
Jonny
  • 15,955
  • 18
  • 111
  • 232

2 Answers2

3

You can't seperate data based on versions.

You could use name space, but I wouldn't

I would use a different instance and copy the production data to that instance, then run all your testing there, with complete confidence you are working with a separate data set.

Some of my projects, data is very specific to companies/users and we set up test companies and test users, but that approach is very dependent on the types of updates, and how segmented your data is. If you have multi-tenant data then you will probably already be using namespaces.

Tim Hoffman
  • 12,976
  • 1
  • 17
  • 29
  • Ok the different instance approach sounds like the kind of nervous wreck approach I need. I'll try it. However I'm guessing it maybe could lead to other problems later because you need to be sure you keep the exact same code on debug and live. And namespaces might be enough for some occasions. – Jonny Apr 22 '14 at 10:33
  • Keeping the code on both versions in sync, should be fairly straightfoward. Use git push for instance and run through the test instance, and if all passes, push the same tagged version to production. Of course you need to manage your appid in app.yaml – Tim Hoffman Apr 22 '14 at 10:52
  • Ok I got so far to get things working using push-to-deploy with git to a separate dev instance. Being a git newbie, I'll have to figure out how to push the code to the live version. – Jonny Apr 23 '14 at 06:52
  • 1
    make sure app.yaml is set with the correct instance appid – Tim Hoffman Apr 23 '14 at 09:14
  • So it's really that easy? I think the docs aren't very clear about how the connection between a repository project and an app engine works but maybe I missed some paragraph. Thanks anyway, I got the stuff working. – Jonny Apr 24 '14 at 03:15
2

You could use namespaces, when storing data in the Datastore, see this Google doc for more information. One for live and one for debug, and have this defined in the app.yaml for each version as an environmental variable.

IanGSY
  • 3,664
  • 1
  • 22
  • 40