Skip to content

Commit fc6b7aa

Browse files
alixhamibshaffer
authored andcommitted
Deletes unused BigQuery region tags an standardizes remaining ones (GoogleCloudPlatform#602)
1 parent e9d4e92 commit fc6b7aa

16 files changed

+28
-44
lines changed

bigquery/api/src/functions/bigquery_client.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,11 @@
2525
* $bigQuery = require '/path/to/bigquery_client.php';
2626
* ```
2727
*/
28-
# [START build_service]
28+
# [START bigquery_client_default_credentials]
2929
use Google\Cloud\BigQuery\BigQueryClient;
3030

3131
$bigQuery = new BigQueryClient([
3232
'projectId' => $projectId,
3333
]);
34-
# [END build_service]
34+
# [END bigquery_client_default_credentials]
3535
return $bigQuery;

bigquery/api/src/functions/browse_table.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323

2424
namespace Google\Cloud\Samples\BigQuery;
2525

26-
# [START browse_table]
26+
# [START bigquery_browse_table]
2727
use Google\Cloud\BigQuery\BigQueryClient;
2828

2929
/**
@@ -63,9 +63,8 @@ function browse_table($projectId, $datasetId, $tableId, $maxResults = 10, $start
6363

6464
return $numRows;
6565
}
66-
# [END browse_table]
66+
# [END bigquery_browse_table]
6767

68-
# [START paginate_table]
6968
/**
7069
* Paginate through a bigquery table.
7170
* Example:
@@ -97,4 +96,3 @@ function paginate_table($projectId, $datasetId, $tableId, $maxResults = 10, $sho
9796

9897
return $totalRows;
9998
}
100-
# [END paginate_table]

bigquery/api/src/functions/copy_table.php

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

2626
use Exception;
27-
# [START copy_table]
27+
# [START bigquery_copy_table]
2828
use Google\Cloud\BigQuery\BigQueryClient;
2929
use Google\Cloud\Core\ExponentialBackoff;
3030

@@ -62,4 +62,4 @@ function copy_table($projectId, $datasetId, $sourceTableId, $destinationTableId)
6262
print('Table copied successfully' . PHP_EOL);
6363
}
6464
}
65-
# [END copy_table]
65+
# [END bigquery_copy_table]

bigquery/api/src/functions/create_dataset.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323

2424
namespace Google\Cloud\Samples\BigQuery;
2525

26-
# [START create_dataset]
26+
# [START bigquery_create_dataset]
2727
use Google\Cloud\BigQuery\BigQueryClient;
2828

2929
/**
@@ -38,4 +38,4 @@ function create_dataset($projectId, $datasetId)
3838
$dataset = $bigQuery->createDataset($datasetId);
3939
return $dataset;
4040
}
41-
# [END create_dataset]
41+
# [END bigquery_create_dataset]

bigquery/api/src/functions/create_table.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323

2424
namespace Google\Cloud\Samples\BigQuery;
2525

26-
# [START create_table]
26+
# [START bigquery_create_table]
2727
use Google\Cloud\BigQuery\BigQueryClient;
2828

2929
/**
@@ -58,4 +58,4 @@ function create_table($projectId, $datasetId, $tableId, $schema)
5858
$table = $dataset->createTable($tableId, $options);
5959
return $table;
6060
}
61-
# [END create_table]
61+
# [END bigquery_create_table]

bigquery/api/src/functions/delete_table.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323

2424
namespace Google\Cloud\Samples\BigQuery;
2525

26-
# [START delete_table]
26+
# [START bigquery_delete_table]
2727
use Google\Cloud\BigQuery\BigQueryClient;
2828

2929
/**
@@ -36,10 +36,8 @@ function delete_table($projectId, $datasetId, $tableId)
3636
$bigQuery = new BigQueryClient([
3737
'projectId' => $projectId,
3838
]);
39-
# [START get_table]
4039
$dataset = $bigQuery->dataset($datasetId);
4140
$table = $dataset->table($tableId);
42-
# [END get_table]
4341
$table->delete();
4442
}
45-
# [END delete_table]
43+
# [END bigquery_delete_table]

bigquery/api/src/functions/extract_table.php

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

2626
use Exception;
27-
# [START extract_table]
27+
# [START bigquery_extract_table]
2828
use Google\Cloud\BigQuery\BigQueryClient;
2929
use Google\Cloud\Storage\StorageClient;
3030
use Google\Cloud\Core\ExponentialBackoff;
@@ -70,4 +70,4 @@ function extract_table($projectId, $datasetId, $tableId, $bucketName, $objectNam
7070
print('Data extracted successfully' . PHP_EOL);
7171
}
7272
}
73-
# [END extract_table]
73+
# [END bigquery_extract_table]

bigquery/api/src/functions/import_from_file.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525

2626
use Exception;
2727
use InvalidArgumentException;
28-
# [START import_from_file]
28+
# [START bigquery_load_from_file]
2929
use Google\Cloud\BigQuery\BigQueryClient;
3030
use Google\Cloud\Core\ExponentialBackoff;
3131

@@ -72,4 +72,4 @@ function import_from_file($projectId, $datasetId, $tableId, $source)
7272
print('Data imported successfully' . PHP_EOL);
7373
}
7474
}
75-
# [END import_from_file]
75+
# [END bigquery_load_from_file]

bigquery/api/src/functions/import_from_storage.php

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

2626
use Exception;
27-
# [START import_from_storage]
27+
# [START bigquery_load_table_gcs_csv]
2828
use Google\Cloud\BigQuery\BigQueryClient;
2929
use Google\Cloud\Storage\StorageClient;
3030
use Google\Cloud\Core\ExponentialBackoff;
@@ -75,4 +75,4 @@ function import_from_storage($projectId, $datasetId, $tableId, $bucketName, $obj
7575
print('Data imported successfully' . PHP_EOL);
7676
}
7777
}
78-
# [END import_from_storage]
78+
# [END bigquery_load_table_gcs_csv]

bigquery/api/src/functions/insert_sql.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323

2424
namespace Google\Cloud\Samples\BigQuery;
2525

26-
# [START insert_sql]
2726
use Google\Cloud\BigQuery\BigQueryClient;
2827

2928
/**
@@ -49,4 +48,3 @@ function insert_sql($projectId, $datasetId, $source)
4948
}
5049
print('Data imported successfully' . PHP_EOL);
5150
}
52-
# [END insert_sql]

bigquery/api/src/functions/list_datasets.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323

2424
namespace Google\Cloud\Samples\BigQuery;
2525

26-
# [START list_datasets]
26+
# [START bigquery_list_datasets]
2727
use Google\Cloud\BigQuery\BigQueryClient;
2828

2929
/**
@@ -39,4 +39,4 @@ function list_datasets($projectId)
3939
print($dataset->id() . PHP_EOL);
4040
}
4141
}
42-
# [END list_datasets]
42+
# [END bigquery_list_datasets]

bigquery/api/src/functions/list_projects.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323

2424
namespace Google\Cloud\Samples\BigQuery;
2525

26-
# [START list_projects]
2726
use Google\Auth\CredentialsLoader;
2827
use Google\Cloud\BigQuery\BigQueryClient;
2928
use Google\Cloud\BigQuery\Connection\Rest;
@@ -43,4 +42,3 @@ function list_projects($maxResults = null)
4342
print($project['id'] . PHP_EOL);
4443
}
4544
}
46-
# [END list_projects]

bigquery/api/src/functions/list_tables.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323

2424
namespace Google\Cloud\Samples\BigQuery;
2525

26-
# [START list_tables]
26+
# [START bigquery_list_tables]
2727
use Google\Cloud\BigQuery\BigQueryClient;
2828

2929
/**
@@ -55,4 +55,4 @@ function get_table($projectId, $datasetId, $tableId)
5555
$dataset = $bigQuery->dataset($datasetId);
5656
return $dataset->table($tableId);
5757
}
58-
# [END list_tables]
58+
# [END bigquery_list_tables]

bigquery/api/src/functions/run_query.php

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323

2424
namespace Google\Cloud\Samples\BigQuery;
2525

26-
# [START all]
2726
use Google\Cloud\BigQuery\BigQueryClient;
2827

2928
/**
@@ -42,17 +41,12 @@
4241
*/
4342
function run_query($projectId, $query, $useLegacySql)
4443
{
45-
# [START build_service]
4644
$bigQuery = new BigQueryClient([
4745
'projectId' => $projectId,
4846
]);
49-
# [END build_service]
50-
# [START run_query]
5147
$jobConfig = $bigQuery->query($query)->useLegacySql($useLegacySql);
5248
$queryResults = $bigQuery->runQuery($jobConfig);
53-
# [END run_query]
5449

55-
# [START print_results]
5650
$i = 0;
5751
foreach ($queryResults as $row) {
5852
printf('--- Row %s ---' . PHP_EOL, ++$i);
@@ -61,6 +55,4 @@ function run_query($projectId, $query, $useLegacySql)
6155
}
6256
}
6357
printf('Found %s row(s)' . PHP_EOL, $i);
64-
# [END print_results]
6558
}
66-
# [END all]

bigquery/api/src/functions/run_query_as_job.php

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

2626
use Exception;
27-
# [START query_as_job]
27+
# [START bigquery_query]
2828
use Google\Cloud\BigQuery\BigQueryClient;
2929
use Google\Cloud\Core\ExponentialBackoff;
3030

@@ -33,8 +33,8 @@
3333
* Example:
3434
* ```
3535
* $query = 'SELECT TOP(corpus, 10) as title, COUNT(*) as unique_words ' .
36-
* 'FROM [publicdata:samples.shakespeare]';
37-
* run_query_as_job($projectId, $query, true);
36+
* 'FROM `bigquery-public-data.samples.shakespeare`';
37+
* run_query_as_job($projectId, $query, false);
3838
* ```.
3939
*
4040
* @param string $projectId The Google project ID.
@@ -69,4 +69,4 @@ function run_query_as_job($projectId, $query, $useLegacySql)
6969
}
7070
printf('Found %s row(s)' . PHP_EOL, $i);
7171
}
72-
# [END query_as_job]
72+
# [END bigquery_query]

bigquery/api/src/functions/stream_row.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323

2424
namespace Google\Cloud\Samples\BigQuery;
2525

26-
# [START stream_row]
26+
# [START bigquery_table_insert_rows]
2727
use Google\Cloud\BigQuery\BigQueryClient;
2828

2929
/**
@@ -66,4 +66,4 @@ function stream_row($projectId, $datasetId, $tableId, $data, $insertId = null)
6666
}
6767
}
6868
}
69-
# [END stream_row]
69+
# [END bigquery_table_insert_rows]

0 commit comments

Comments
 (0)