0

I can't copy a table to a different dataset, but I can do it to the same one. Am I doing anything wrong?

var project_id = "project"
var dataset_id = "testDb";
var dataset_bk_id = "testDbBk"
var table_id = "test";
var dataset = bigquery.dataset(dataset_id);
var dataset_bk = bigquery.dataset(dataset_bk_id);
var table = dataset.table(table_id);
var table_bk = dataset_bk.table(table_id);
var metadata = {
  createDisposition:"CREATE_IF_NEEDED",
  destinationTable: { //required if allowLargeResults = true
    projectId:project_id,
    datasetId:dataset_bk_id,
    tableId:table_id
  },
  writeDisposition:"WRITE_TRUNCATE" 
};
table.copy(table_bk, metadata, function(err, job, apiResponse) {
    if (err){
      reject(err.message);
    }else{
      fulfill("Table " + table_id + " copied.");
    }
});

Another thing that concerns me is the fact that I'm not getting any error in that bit of code.

Zachary Newman
  • 20,014
  • 4
  • 39
  • 37
Jorge Z
  • 25
  • 6
  • Please provide the project_id and job_id of a copy that failed and we can help figure out what happened. Or provide a trace of the http response for the initial jobs.insert and the http response for the final jobs.get where the job went to the `done` state. – Michael Sheldon Nov 06 '15 at 22:54
  • I thought as table.copy didn't return any errors the job had been completed successfully but I can see in job.metadata.status an error 'Not found table_id'. Now I know I have to check the job status I can keep investigating. Thanks. – Jorge Z Nov 09 '15 at 11:47

0 Answers0