File tree Expand file tree Collapse file tree 1 file changed +4
-5
lines changed
bigquery/api/src/functions Expand file tree Collapse file tree 1 file changed +4
-5
lines changed Original file line number Diff line number Diff line change 24
24
namespace Google \Cloud \Samples \BigQuery ;
25
25
26
26
# [START insert_sql]
27
- use Google \Cloud \ServiceBuilder ;
27
+ use Google \Cloud \BigQuery \ BigQueryClient ;
28
28
29
29
/**
30
30
* @param string $projectId The Google project ID.
33
33
*/
34
34
function insert_sql ($ projectId , $ datasetId , $ source )
35
35
{
36
- // instantiate the bigquery table service
37
- $ builder = new ServiceBuilder ([
36
+ // instantiate the bigquery client
37
+ $ bigQuery = new BigQueryClient ([
38
38
'projectId ' => $ projectId ,
39
39
]);
40
- $ bigQuery = $ builder ->bigQuery ();
41
- // create the import job
40
+ // run a sync query for each line of the import
42
41
$ file = fopen ($ source , 'r ' );
43
42
while ($ line = fgets ($ file )) {
44
43
if (0 !== strpos (trim ($ line ), 'INSERT ' )) {
You can’t perform that action at this time.
0 commit comments