在GAE上用Java编写Cron作业来运行BigQuery [英] Write Cron Job in Java on GAE to Run BigQuery

查看:118
本文介绍了在GAE上用Java编写Cron作业来运行BigQuery的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在GAE上运行一个内部调用BigQuery的cron作业。



我目前能够运行BigQuery,但我需要使用我的凭据登录。但是我想在没有任何登录的情况下为BigQuery运行cron作业。



任何帮助都将不胜感激。


















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




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


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.

解决方案

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();

这篇关于在GAE上用Java编写Cron作业来运行BigQuery的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆