Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 4 additions & 5 deletions bigquery/api/src/functions/insert_sql.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
namespace Google\Cloud\Samples\BigQuery;

# [START insert_sql]
use Google\Cloud\ServiceBuilder;
use Google\Cloud\BigQuery\BigQueryClient;

/**
* @param string $projectId The Google project ID.
Expand All @@ -33,12 +33,11 @@
*/
function insert_sql($projectId, $datasetId, $source)
{
// instantiate the bigquery table service
$builder = new ServiceBuilder([
// instantiate the bigquery client
$bigQuery = new BigQueryClient([
'projectId' => $projectId,
]);
$bigQuery = $builder->bigQuery();
// create the import job
// run a sync query for each line of the import
$file = fopen($source, 'r');
while ($line = fgets($file)) {
if (0 !== strpos(trim($line), 'INSERT')) {
Expand Down