문제

I want to run a cron job on GAE that internally calls BigQuery.

I am currently able to run BigQuery but I need to log in with my credentials. But I would like to run the cron job for BigQuery without any login.

Any help would be highly appreciated.

도움이 되었습니까?

해결책 2

I am successfully able to implement it in java.Before performing it we need to generate client id for service account.

private static final HttpTransport TRANSPORT = new NetHttpTransport();
private static final JsonFactory JSON_FACTORY = new JacksonFactory();
private static Bigquery bigquery;




AppIdentityCredential credential = new AppIdentityCredential(Collections.singleton(BigqueryScopes.BIGQUERY));
bigquery = new Bigquery.Builder(TRANSPORT, JSON_FACTORY, credential)
            .setApplicationName("BigQuery-Service-Accounts/0.1")
            .setHttpRequestInitializer(credential).build();

다른 팁

I know it's not the java you're expecting. The secret is to use AppAssertionCredentials. Here is the python sample:

from apiclient.discovery import build
from oauth2client.appengine import AppAssertionCredentials
import httplib2
from google.appengine.api import memcache

scope = 'https://www.googleapis.com/auth/bigquery'

credentials = AppAssertionCredentials(scope=scope)

http = credentials.authorize(httplib2.Http(memcache))

return build("bigquery", "v2", http=http)
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top