Skip to content

Commit cbfb0df

Browse files
authored
small tweaks to bigquery insert sql sample (GoogleCloudPlatform#249)
1 parent 7f16b65 commit cbfb0df

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

bigquery/api/src/functions/insert_sql.php

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
namespace Google\Cloud\Samples\BigQuery;
2525

2626
# [START insert_sql]
27-
use Google\Cloud\ServiceBuilder;
27+
use Google\Cloud\BigQuery\BigQueryClient;
2828

2929
/**
3030
* @param string $projectId The Google project ID.
@@ -33,12 +33,11 @@
3333
*/
3434
function insert_sql($projectId, $datasetId, $source)
3535
{
36-
// instantiate the bigquery table service
37-
$builder = new ServiceBuilder([
36+
// instantiate the bigquery client
37+
$bigQuery = new BigQueryClient([
3838
'projectId' => $projectId,
3939
]);
40-
$bigQuery = $builder->bigQuery();
41-
// create the import job
40+
// run a sync query for each line of the import
4241
$file = fopen($source, 'r');
4342
while ($line = fgets($file)) {
4443
if (0 !== strpos(trim($line), 'INSERT')) {

0 commit comments

Comments
 (0)