2017-10-11 1 views

답변

1

composer.json

{ 
    "require": { 
     "google/cloud": "^0.13.0", 
     "google/apiclient": "^2.0" 
    } 
} 

나는 당신의 대답 _ 'jobConfig'_위한 테이블을

 $builder = $this->getServiceBuilder(); 
     $bigQuery = $builder->bigQuery(); 
// Get an instance of a previously created table. 
     $dataset = $bigQuery->dataset('wr_temp'); 
     $table = $dataset->table('shop_api_order_id'); 

// Begin a job to import data from a CSV file into the table. 
     if (!is_file($data['params']['filename'])) { 
      $this->e('File ' . $data['params']['filename'] . ' cannot be located'); 
      return false; 
     } 
     $job = $table->load(
       fopen($data['params']['filename'], 'r'), array(
      'jobConfig' => array(
       "writeDisposition" => 'WRITE_TRUNCATE', 
       "schema" => array(
        "fields" => array(array(
          "name" => 'order_id', 
          "type" => 'INTEGER', 
          "mode" => 'NULLABLE', 
         ) 
        ) 
       ) 
      ) 
       ) 
     ); 

     $isComplete = $job->isComplete(); 

     while (!$isComplete) { 
      sleep(1); // let's wait for a moment... 
      $job->reload(); 
      $isComplete = $job->isComplete(); 
     } 
+0

감사를 덮어 코드의이 작품을 내가 필요하지만 할 무엇인가가 PHP에서 쿼리의 테이블을 작성하는 방법을 알고 계십니까? –

+0

@ pierre-emmanuel이 새로운 질문을하고 다른 사람이 대답합니다. – Pentium10