Esempio n. 1
0
 function queryBigQuery($sql, $dataset, $table_name)
 {
     $queryConfig = new Google_Service_Bigquery_JobConfigurationQuery();
     $queryConfig->setDestinationTable($this->createDestinationTable($dataset, $table_name));
     $queryConfig->setQuery($sql);
     $config = new Google_Service_Bigquery_JobConfiguration();
     $config->setDryRun(false);
     $config->setQuery($queryConfig);
     $job = new Google_Service_Bigquery_Job();
     $job->setConfiguration($config);
     print "<PRE>";
     print_r($job);
     exit;
     $job = $this->service->jobs->insert($this->project_id, $job);
     return $job;
 }
Esempio n. 2
0
function asyncQuery(Google_Service_Bigquery $bigquery, $projectId, $queryString, $batch = false)
{
    $query = new Google_Service_Bigquery_JobConfigurationQuery();
    $query->setQuery($queryString);
    $query->setPriority($batch ? 'BATCH' : 'INTERACTIVE');
    $config = new Google_Service_Bigquery_JobConfiguration();
    $config->setQuery($query);
    $job = new Google_Service_Bigquery_Job();
    $job->setConfiguration($config);
    return $bigquery->jobs->insert($projectId, $job);
}