appengine sdk clears datastore - google-app-engine

I am having a slight problem with the appengine SDK.
When I close it, it clears the datastore.
It is a little annoying to create the test data/users every day, so any help would be great.
I am running OSX, just so you know. And I have read this question.
But I have no file anywhere on my machine with that name. Not even when the SDK is running and the datastore contains data.
The project is not set to clear datastore on startup and I can't see anything else relating to it in the settings.
Does anyone know why this is happening?

By default, the Python SDK puts the datastore files in your system's temporary directory, thus the persistence of the datastore is not guaranteed. Provide a different path using the --datastore_path argument of dev_appserver.py.

Related

How can the Google Cloud Datastore Emulator verify our datastore-index.xml?

We use the Google Cloud Datastore Emulator. It autogenerates indexes.yaml. But as we did with the old Google Plugin for Eclipse, we want to get missing-index messages in the local development environment, and not later in cloud deployment. So, we want the Emulator to use our manually-maintained datastore-indexes.xml
How do we configure the use of a specific datastore-indexes.xml in the Google Cloud Datastore Emulator? I don't see any relevant command-line switches in the help text.
EDIT:
My answer was based on the dev_appserver emulator, not the current one. After running some tests, it appears that the emulator only has endpoints for a subset of the Datastore API methods, and index building (nor export/import for that matter) are available.
Leaving my previous answer to avoid repeated answers with the same wrong info:
_________
According to the docs, if autoGenerate="false" is in your datastore-indexes.xml, the development server should ignore the contents of WEB-INF/appengine-generated/datastore-indexes-auto.xml.
I think this might be what you're looking for, although I have not yet tested it.

How do I delete/update files in Google Compute Engine

I have everything set up so that my discord bot runs on Google Cloud, but my only problem is that I can't seem to figure out how to update or delete files on the cloud disk drive. I am searching everywhere and I can't seem to find it. This bugs me because now I have to completely rename my bot every time I upload it or else I can't run it. This issue is really hurting my coding because I want to move forward, but I am very thorough and this issue will haunt me if I just leave it be.
I found the answer finally and to edit files you have to use vi, vim, or nano in the terminal. To remove the files you have to use rm. I think Google should make a better way to access the directory and edit my disk without having to use command lines, but I doubt they will.
Please note that GCP only offers e virtual infrastructure (for Compute Engine). The VM still runs a regular Operating System (with certain files pre packaged in to make sure it works with the cloud environment). Management of the operating system is still up to the user.
You can use something like App Engine if you only want to manage and update the code for your application.
Alternatively, you can also use gcloud compute scp to copy files from a local system directly to the VM.

Restore app-engine entities locally

Hi guys I've dumped (made a backup) of my Appengine datastore entities,following this tutorial, now I wonder if there is a way to restore the data locally ? so I can do some test and debug.
In windows, the datastore is in the directory
C:\Users\UserName\AppData\Local\Temp\AppName
In OSx this question can help you
In this directory are storade the datastore.db (the local storage), change the name (the app should not be running, and if is locked, kill all the python process)
Now go to the appengine dashboard
click in your app link
click in Blob Viewer (i'm assumming that you did the backup into a blobstore)
click in the file name
click in download
rename the file to datastore.db
copy to the previous path
start the app
Remote API (as koma mentions) is the main GAE-documented approach, and it's a good approach. Alternatively, you can download the entities using the cloud download tool, write your own store reader/deserializer, and execute it within your dev server local instance: http://gbayer.com/big-data/app-engine-datastore-how-to-efficiently-export-your-data. Read the part about the New Approach...
While these options are not automatic and require engineering, I really wanted to point out the side effect of doing this: We have been facing performance issues in the local development server for months now, specifically when the datastore has more than 1,000 entities with over 50 indexes. Just search for "require_indexes slow" and you'll see what I'm talking about.
I'm sure you have a solid reason to import lots of data locally for testing and debugging, just wanted to let you know your application will perform extremely slow, and debug mode will be impossibly slow; we can't even use debug mode with our setup anymore.
If you want to get some test data in your local db, you could copy some using the remote api

My GAE python development datastore is never persisted to a file

I have just started using GAE (Python 2.7 SDK 1.6.4) , I have set up a
simple test project using Pydev (latest version) in eclipse (indigo)
on Windows XP (SP3).
It all works fine, my app can record data in the datastore and the blobstore
and then retrieve it, but when I stop the development server and start
it again the data in the datastore is lost. This is not the case for
the blobstore which is retaining blobs fine and I can see the
blobstore folder that gets created in C:\Temp
I did the sensible thing and look back through old posts and found
that most people who have this problem solve it by changing the
location of the datastore file, so I used the following parameters;
--datastore_path="${workspace_loc}/myproject/datastore"
--blobstore_path="${workspace_loc}/myproject/blobstore"
"${workspace_loc}/myproject/src"
I moved the blobstore at the same time as you can see.
The blobstore still works, and now the blobstore folder is created in
myproject folder as expected. The datastore file is still not created
however, and when I stop and restart the development server the data
is still lost.
The dev server startup logs include the following entry
WARNING 2012-04-20 10:49:04,513 datastore_file_stub.py:513] Could not
read datastore data from C:\myworkspace\myproject\datastore
So I know it is trying to create the datastore in the correct place.
Finally I lifted the whole eclipse workspace folder and copied it to
another computer with exactly the same setup except it is running
Windows 7 instead of Windows XP.
Everything works fine there - both the datastore file and blobstore
folder are now created where I expect them to be.
I have set up eclipse, python, gae, my project and my eclipse launch
file in exactly the same way on two computers, it works on one and
not the other. Maybe XP is something to do with it but to be honest I
think that's unlikely.
The only other clue I have come up with is that a recent change to the
GAE development server stopped writing to the datastore file after
every change and only flushes on exit, this problem may be closely related to mine;
App Engine local datastore content does not persist
However adding the following to my code did not help at all.
from google.appengine.tools import dev_appserver
import atexit
atexit.register(dev_appserver.TearDownStubs)
So it's not down to incorrect termination sequence either as far as I
can tell although it may be that I was just added it in the wrong place (I'm am new to python).
Anyway I am stumped and I would be really grateful for suggestions you
guys can come up with.
It's probably http://code.google.com/p/googleappengine/issues/detail?id=7244 and a bug. Hopefully a fix will be available soon.
did you try:
--storage_path=...
Path at which all local files (such as the Datastore, Blobstore files, Google Cloud Storage Files, logs, etc) will be stored, unless overridden by --datastore_path, --blobstore_path, --logs_path, etc.
found at https://developers.google.com/appengine/docs/python/tools/devserver?csw=1

How to download all datastore entities on Google App Engine?

I've read the GAE docs, and I can't seem to figure out how to download all my entity data.
What I'd love to do is download the whole thing as a big TSV file (or something I can easily munge into one), so I can import my various entities into a spreadsheet and fiddle with them.
But I'm stuck at the starting gate. I don't understand the first few bits of the docs: "This document applies to apps that use the master/slave datastore. If your app uses the High Replication datastore..." -- I'm not even sure which I have, or how I would tell.
Assuming I have the simpler master/slave, the docs continue: "...you can use the Python appcfg.py tool by installing the Java version of the remote_api handler..." but, again, I'm not quite sure what they mean or where I find this appcfg.py tool.
Sorry for such a n00b question, but is there some sort of walk-through? I just want to download my datastore!
Thanks!
Master/Slave is the default (for now), so that's almost certainly what you're using. You can confirm at https://appengine.google.com/ -> app-id -> Administration -> Application Settings -> Datastore Replication Options.
To download your data, first install Remote API for Java, then use appcfg.py to download data:
appcfg.py download_data --application=<app-id> --url=http://<appname>.appspot.com/[remote_api_path] --filename=<data-filename>
There is nothing you need to do other than just follwiong the google's own documentaion. There is no workaround or walkthrough. I am not sure about java. In python , only thing you need to do is enable remote_api in your app.yaml.
appcfg.py can be found inside the root directory of appengine SDK.

Resources