I know appengine datastore and what is cloud datastore, using cloud datastore is always an confusion for me, following are my questions:
does cloud datastore requires Compute Engine ?
(in google docs i saw like enable compute engine)
how to access cloud datastore from appengine application (this is very needed)
how to enable multiple application to access this common datastore ?
Note: I know how to activate it, but I didn't get clear answers for my questions above.
Your questions:
1) No, cloud datastore can also be user by other platforms
2) App engine has native support to use the (cloud) datastore. The cloud datastore is based on the App Engine datastore to make it available for others.
3) You can share the cloud datastore, but see this issue
Atlast, i can able to access from cloud datastore from appengine application, following are my answer,
Ans For Ques 1:
Cloud Datstore doesn't require compute engine instance.
Ans for Ques 2:
To access cloud datastore, you need either service account credentials or u must have access token for authenticated user with Scopes set to Datastore, and user email.
Use Google api Client library,or simply use ProtoBuf library provided in documentation.
Ans for Ques 3:
simply use create credentials from application u want to access and use it in other applications
https://developers.google.com/datastore/docs/getstarted/overview
Thanks!
Related
I have a Cloud Function, in this function I'm connecting database through secrets by GCP
for my secrets I'm using different project id (com-project-data)
For my Google Cloud Function I'm using another project id (com-project-common)
Exists a conflict because each project have a different service account, then I'm asking the following question...
Can I inject two differents service accounts in my Cloud Function? If this is probably,
How Can I do it?
A service account is one identity. Your function has its own identity. Then, this identity should access the required resources.
Therefore, grant the Cloud Functions service account the permission to access the resources, secret or whatever.
In that concept, you can easily understand that you can't have 2 identities for the same service (Cloud Functions can't be schizophrenia!)
Of course, you can do unrecommended things, like using a service account key file for each project and have 2 authentications, but it's a terrible thing and you have to avoid this pattern.
I'm building a small Google App Engine application with the purpose of collecting statistics from a few sources, including page hits on our public web page via google analytics. I'm stumped though over how to access their API, I can't seem to make sense of googles new developers console regarding general structure and their new security rules.
Quick overview:
My application is java based and hosted in GAE and would like to access simple Analytics data. I'm not sure if the fact that it's a GAE application is relevant
The monitored site is NOT hosted in GAE and uses analytics.js.
My own google account has access to the statistics on https://www.google.com/analytics.
All documentation I find regarding accessing Analytics API (e.g. https://developers.google.com/analytics/devguides/reporting/core/v3/quickstart/service-java) points me to https://console.developers.google.com and setup things there. The problem is, only my own application exists in console.developers.google.com - not the monitored application. Is the docs valid only for GAE applications? Or can externally hosted applications be added to the console somehow? Is the console relevant for the client side of analytics?
What I'm looking for is any way to create API keys for my application to use - how is this done? Any step in the right direction is appreciated.
From DaImTo's comments (and the ones you posted after), seems like what you needed was :
"Its your own data go with a service account daimto.com/google-developer-console-service-account when its created take the service account email address add it as a user in the admin section of the Google analytics website at the ACCOUNT level it will then have access. You can use it with the core reporting api."
and this link
(just posting this as an answer in case the comments get trashed)
I created java application (myLocalAPP) to connect and access google cloud datastore.
So, I use Google cloud Datastore API.
However, I'm now finding that I have to use myLocalAPP in a GAE app. (I export myLocalAPP to jar and add it to GAE /lib).
The problem is that GAE has different API to connect to Google datastore and the connection,insert and retrieve methods that I've created them in myLocalAPP aren't working when I call them from GAE application.
I got exception such:
java.lang.Error: compilation problems:
The method beginTransaction(TransactionOptions) in the type DatastoreService is not applicable for the arguments (DatastoreV1.BeginTransactionRequest)
The method lookup(DatastoreV1.LookupRequest) is undefined for the type DatastoreService
Entity.Builder cannot be resolved to a type
Type mismatch: cannot convert from DatastoreV1.Entity to Entity
So, I go back to myLocalAPP and try to change the connection method. I change the datastore object from
Datastore datastore = DatastoreFactory.get().create(DatastoreHelper.getOptionsfromEnv()
.dataset(datasetId).build());
to
Datastore datastore = (Datastore )DatastoreServiceFactory.getDatastoreService();
but casting does not work. I need to use DatastoreService object and I have to rewrite the other methods. I would like to know is there any way other than rewriting the code?? and if I rewrite the code using GAE datastore API, is myLocalAPP will work again locally?? (not on GAE).
Thanks,
The client library for communicating with Google Cloud Datastore is not currently compatible with the API used by App Engine Datastore.
There's an open issue on the Google Cloud Datastore issue tracker to enhance the App Engine Java client library to work on top of Cloud Datastore (this would also enable the use of higher-level libraries like Objectify). You can subscribe to that issue to receive updates.
Is it possible to create my own users database for a google app engine app, so that it's not required for someone to have a google/openId account when he registers ?
Yes, but you will need to write all utility methods for providing proper authentication for your users. Rather than do this, I would recommending looking into the authentication services that Firebase can provide (Google acquired Firebase in 2014). At the moment, it seems Firebase will become integrated into many Google Cloud Services.
I have a Google App Engine Java application, which uses Appengine datastore for its persistence (Using JPA and Datanucleus).
Now I want to migrate my backend(database) to Google Cloud SQL.
I have already created cloud sql account and instance. I also granted permission for my GAE app to use this instance.
Now, how I can i rewrite my app or what are the changes I should make to my application, in order to migrate to cloud sql.
Any good tutorial is there for it?
Any help is greatly welcomed.
I would suggest following Using Google Cloud SQL with App Engine Java SDK. Once you've configured an example database, create new tables for the entities in your datastore.
For the actual data migration you have a few possible routes:
Download your datastore locally, manipulate the entries into SQL INSERT statements, and upload them to Cloud SQL
Write a script that reads through the datastore and writes rows to your SQL datastore (most likely using a task queue and datastore cursor)
Ignore the old data in your app and start from scratch