Are repeated properties equivalent to array properties? - google-app-engine

From the Cloud Datastore section of Migrating Services from the Standard Environment to the Flexible Environment:
The same Cloud Datastore data is available regardless of if you use
the App Engine libraries, the Google Cloud client libraries, or call
the API directly.
In the context of the same entity does a repeated property from an App Engine library (like python ndb client library or Java Datastore API for example) correspond to an array property from the Google Cloud Datastore API?

Correct, these are equivalent concepts.

Related

Can Google Cloud functions share a datastore with Appengine?

I have an old AppEngine Java application using the AppEngine datastore. Is this what the marketing renamers at Google now (2019) call "Cloud Datastore"?
Can I create Google Cloud Functions that interact with the same datastore, and what are the steps needed to do so?
Yes, it's the same datastore. Also called/soon-to-be Cloud Firestore in Datastore mode (which all older apps will be converted to at some point).
Yes, you can access it from anywhere, even from outside Google Cloud. From Cloud Datastore (emphasis mine):
You can access Cloud Datastore from anywhere using the Cloud
Datastore API. Use the Google Cloud client libraries to store and
retrieve data from Cloud Datastore.
The same Cloud Datastore data is available regardless of if you use the App Engine libraries, the Google Cloud client libraries, or call
the API directly.
The major steps to access the datastore from a Cloud Function:
you can't use the GAE-specific client libraries like the one you likely used in your old app, you'll have to use one of the generic client libraries (or the REST or RPC APIs)
you'll have to give your CF's Identity/service account the proper access permissions, see Setting up authentication and Accessing your database from another platform.

Google Cloud Datastore on App Engine with Java. Which package to use?

Newbie to Datastore. I found two tutorials on the GCP site to use Datastore on App Engine. Which one should I use?
There are subtle differences in how the APIs work.
https://cloud.google.com/datastore/docs/datastore-api-tutorial
uses package (import com.google.appengine.api.datastore.Entity;)
vs.
https://cloud.google.com/appengine/docs/standard/java/building-app/cloud-datastore
uses package (import com.google.cloud.datastore.Entity)
Question: Is there a preferred package to use and call the datastore API while on App Engine - com.google.cloud.datastore.Entity vs. com.google.appengine.api.datastore.Entity?
The library with this package com.google.appengine.api.datastore (aka "Datastore API for Java") is intended for use by Java 7 and Java 8 applications which run on AppEngine.
The library with this package com.google.cloud.datastore (aka "Cloud Datastore client library") is intended for use by any Java 8 application regardless of where it is deployed (GKE, GCE, on-premises etc)
From the docs:
Datastore API for Java is a low-level Datastore API built into the App Engine SDK to provide direct access to all Datastore features and is described throughout the App Engine Datastore documentation for Java.
Cloud Datastore client library is a library that can be used by apps in the App Engine standard Java 8 runtime, by applications in the App Engine flexible environment, and by non App Engine applications as well.
So, according to Google, both are valid choices subject to these limitations ...
If you are running Java 7 then you cannot use Cloud Datastore client library
If your application is not deployed to AppEngine then you cannot use Datastore API for Java
These limitations describe the scenarios in which one or other of these libraries cannot be used. Google offers no advice on which one should be used. This is because the two libraries are functionally equivalent so, assuming that the limitations described above do not apply to your usage, the choice is probably moot.

Is it possible to implement create a web project in Spring Boot + Datastore?

I'm currently new to web developing and right now I started with a Spring Boot application which I converted to standard App Engine project. I'm wondering if it is possible to not convert my Spring Boot application to my App Engine project and still use Datastore as database?
Yes, it's possible to use the Cloud Datastore from an app in the GAE flexible environment, from outside GAE or even from outside the Google Cloud. From Cloud Datastore (emphasis mine):
You can access Cloud Datastore from anywhere using the Cloud
Datastore API. Use the Google Cloud client libraries to store and
retrieve data from Cloud Datastore.
The same Cloud Datastore data is available regardless of if you use
the App Engine libraries, the Google Cloud client libraries, or call
the API directly.
But you can't use the GAE Standard Environment Client Libraries, you have to use either the Cloud Datastore Client Libraries or the Cloud Datastore API v1.
Potentially of interest: the Deploying to the App Engine Flexible Environment guide happens to use a spring boot app as example.

Is it possible to use the appengine/datastore package on the GAE flex environment?

There are two different datastore packages for Google App Engine:
google.golang.org/appengine/datastore and cloud.google.com/go/datastore.
The documentation for the appengine/datastore package uses the standard environment while the documentation for the cloud package uses the flex environment.
I have a Go application which uses the appengine/datastore package on the standard GAE environment. If I want to migrate this application from the standard environment to the flex environment do I need to switch to the cloud.google.com/go/datastore package, or can I continue using the appengine/datastore package? If not, why not?
You need to migrate to cloud.google.com/go/datastore.
From Migrating Services from the Standard Environment to the Flexible Environment:
The App Engine flexible environment does not provide the API libraries
present in the App Engine SDK. If you decide to migrate your
application from the App Engine standard environment to the flexible
environment, you must update your code to use services and APIs
that are available across all Google Cloud Platform environments.
And from Cloud Datastore:
You can access Google Cloud Datastore from anywhere using the
Cloud Datastore API. Use the Google Cloud client libraries to
store and retrieve data from Cloud Datastore.
The same Cloud Datastore data is available regardless of if you use
the App Engine libraries, the Google Cloud client libraries, or call
the API directly.
At this time ORM libraries that available in the standard environment
such as ndb and Objectify are not supported outside of the
standard environment.
For more information, see the following guide:
Using Cloud Datastore

what's the difference between google.appengine.ext.ndb and gcloud.datastore?

ndb: (from google.appengine.ext import ndb)
datastore: (from gcloud import datastore)
What's the difference? I've seen both of them used, and hints they both save data to google datastore. Why are there two different implementations?
The Python NDB Client is specific to Python Applications running on Google App Engine. The datastore client removes that restriction and you can run your Python application anywhere, including Google App Engine, Google Compute Engine or anywhere else.
Exceprt form - https://cloud.google.com/appengine/docs/python/ndb/
The Google Datastore NDB Client Library allows App Engine Python
apps to connect to Cloud Datastore.
In addition, the NDB client has certain features (e.g. caching) while the other does not appeat to support.
The reason for the two implementations is that originally, the Datastore (called App Engine Datastore) was only available from inside App Engine (through a private RPC API). On Python, the only way to access this API was through an ORM-like library (NDB). As you can see on the import, it is part of the App Engine API.
Now Google has made the Datastore available outside of App Engine through a restful API called Cloud Datastore API. gcloud library is a client library that allows access to different rest APIs from Google Cloud, including the Cloud Datastore API.

Resources