Tip:
Highlight text to annotate it
X
FRED SAUER: Can I pre-populate the data store?
Is there a front end to add, remove, or update entries in
the data store?
MANDY WAITE: OK, so now I'm going to punt this one a
little bit, because we discussed this one yesterday,
and we talked about some things, some articles that
have been published about this very thing.
So I'd like to actually talk to you about that.
Bounce the question back to you and ask what you feel is
the best way to pre-populate.
FRED SAUER: So, I think the answer depends a little bit if
you have some data on your client on your desktop-- maybe
there's some legacy data that you need to import, some
configuration data that you want to do programmatically--
the development server, the SDK, does have a little tool
for uploading data.
That works fine for kind of small scale, and that's a tool
that's been around for a long time.
Probably what you want to do if you're doing anything
larger than trivial operations is just create a Cloud
Endpoints application or version of your app.
That doesn't mean you have to build your entire service
around it, and maybe this is an administrative gateway or
this is a way that mobile clients kind of upload data to
your application.
Cloud Endpoints is a great easy way to create an API and
will automatically generate client libraries for Android,
for iOS, for HTML5, and from any of those three clients you
can make your calls to the server side.
If you're doing Python--
a colleague of ours, Danny Hermes, has a pretty cool
project called Cloud Endpoints Proto Datastore and--
or maybe it's Endpoints Proto Datastore--
but it's an application where you essentially define your
Python datastore models, and then you just swap up the
class name that you're inheriting from, and then all
your classes magically turn into Cloud Endpoints.
And so you can make calls, like insert entities into the
datastore, remove them, do queries, all really easy.
So that's probably the way that I would go.
And then there's maybe one more trick up your sleeve.
The SDK has a thing called a remote API, remote_api.
[INAUDIBLE]
And it's a way for the development server to
essentially proxy its datastore memcache requests to
the production environment.
So what you do is you deploy a special version of your app
with just like a one line config flag that says enable
the remote API, and then you can run your code locally as
if you're connected to the datastore, but everything's
being proxied to the Cloud for you.
So that's another neat trick for
migrating data in the cloud.
Or it's a great way to do debugging.
You connect to your production or staging environment, and
you can kind of sort of interact with it while you're
in a Python console.
You have your real data models, but you're looking at
your real data.
MANDY WAITE: Excellent.