Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/google-app-engine/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Google app engine 使用Java将数据从Google云存储加载到BigQuery_Google App Engine_Google Bigquery_Google Cloud Storage - Fatal编程技术网

Google app engine 使用Java将数据从Google云存储加载到BigQuery

Google app engine 使用Java将数据从Google云存储加载到BigQuery,google-app-engine,google-bigquery,google-cloud-storage,Google App Engine,Google Bigquery,Google Cloud Storage,我想上传数据从谷歌云存储到大查询表。 下面是我创建作业的代码: Job job = new Job(); JobConfiguration config = new JobConfiguration(); JobConfigurationLoad loadConfig = new JobConfigurationLoad(); List<String> sources = new ArrayList<String>(); sour

我想上传数据从谷歌云存储到大查询表。 下面是我创建作业的代码:

    Job job = new Job();
    JobConfiguration config = new JobConfiguration();
    JobConfigurationLoad loadConfig = new JobConfigurationLoad();

    List<String> sources = new ArrayList<String>();
    sources.add("gs://bucket/file.cvs");
    loadConfig.setSourceUris(sources);

    TableReference tableRef = new TableReference();
    tableRef.setDatasetId("DATASET_ID");
    tableRef.setTableId(TABLE_ID);
    tableRef.setProjectId(PROJECT_ID);
    loadConfig.setDestinationTable(tableRef);

    List<TableFieldSchema> fields = FieldsBigQuery.schema();

    TableSchema schema = new TableSchema();
    schema.setFields(fields);

    loadConfig.setSchema(schema);
    config.setLoad(loadConfig);
    job.setConfiguration(config);

    Insert insert = _bigquery.jobs().insert(PROJECT_ID, job);
    insert.setProjectId(PROJECT_ID);
    JobReference jobRef =  insert.execute().getJobReference();
Job Job=新作业();
JobConfiguration配置=新的JobConfiguration();
JobConfigurationLoadConfig=新的JobConfigurationLoad();
列表源=新的ArrayList();
添加(“gs://bucket/file.cvs”);
loadConfig.setSourceUris(源代码);
TableReference tableRef=新的TableReference();
tableRef.setDatasetId(“数据集_ID”);
tableRef.setTableId(TABLE_ID);
tableRef.setProjectId(项目ID);
loadConfig.setDestinationTable(tableRef);
List fields=FieldsBigQuery.schema();
TableSchema schema=new TableSchema();
schema.setFields(字段);
loadConfig.setSchema(模式);
config.setLoad(loadConfig);
setConfiguration(配置);
Insert Insert=\u bigquery.jobs().Insert(项目ID,作业);
插入.setProjectId(项目ID);
JobReference jobRef=insert.execute().getJobReference();
我没有任何错误或异常,但它不会将任何数据上载到我的表(表大小为0B)。我试图创建一个没有任何数据的表,然后将数据上传到此表,但事实并非如此

如果有任何帮助,我将不胜感激


非常感谢

记住使用以下工具检查作业状态:

JobStatus status =
    _bigquery.jobs().get(PROJECT_ID, jobRef.getJobId()).execute().getStatus();
System.out.println(status.toPrettyString());

如果一切正常,作业状态可能处于挂起或运行状态,您必须等待作业完成。或者,您可以阅读无法运行的原因和消息。

请记住检查作业状态:

JobStatus status =
    _bigquery.jobs().get(PROJECT_ID, jobRef.getJobId()).execute().getStatus();
System.out.println(status.toPrettyString());
如果一切正常,作业状态可能处于挂起或运行状态,您必须等待作业完成。或者,您可以阅读无法运行的原因和消息