Skip to content
This repository has been archived by the owner on Oct 3, 2023. It is now read-only.

Commit

Permalink
fix(samples): bug fix for removing buckets from bq. (#548)
Browse files Browse the repository at this point in the history
* Removed env variables and buckets from creating BQ.

* Fix: removed buckets from BQ import

* pr fix: imports.

* 馃 Updates from OwlBot post-processor

See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md

* pr fix: fixed test.

* pr fix: added comment.

* fix(samples): bug fix for removing buckets from bq.

* pr fix: moved commented lines

* pr fix: added dot to importproductsbigquerytable.

Co-authored-by: Sita Lakshmi Sangameswaran <sitalakshmi@google.com>

* pr fix: added dot in importproductsbigquerytable

Co-authored-by: Sita Lakshmi Sangameswaran <sitalakshmi@google.com>

* 馃 Updates from OwlBot post-processor

See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md

Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
Co-authored-by: Sita Lakshmi Sangameswaran <sitalakshmi@google.com>
  • Loading branch information
3 people committed Sep 26, 2022
1 parent abc4b3e commit c407fe3
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
Expand Up @@ -37,13 +37,16 @@ public class ImportProductsBigQueryTable {

public static void main(String[] args) throws IOException, InterruptedException {
String projectId = ServiceOptions.getDefaultProjectId();
// To check for error handling, replace the below variable with the invalid branch name.
// String branchName = "invalid_branch_name";
String branchName =
String.format(
"projects/%s/locations/global/catalogs/default_catalog/branches/0", projectId);
String datasetId = "products";
// To check for error handling, replace the below variable with table id that contains invalid
// products.
// String tableId = "products_some_invalid";
String tableId = "products";
// TO CHECK ERROR HANDLING USE THE TABLE WITH INVALID PRODUCTS:
// tableId = "products_some_invalid"

importProductsFromBigQuery(projectId, branchName, datasetId, tableId);
}
Expand Down
Expand Up @@ -38,7 +38,7 @@ public static void main(String[] args) throws IOException {
String validProductsSourceFile =
ProductsCreateBigqueryTable.class.getResource("/products.json").getPath();
String invalidProductsSourceFile =
ProductsCreateBigqueryTable.class.getResource("products_some_invalid.json").getPath();
ProductsCreateBigqueryTable.class.getResource("/products_some_invalid.json").getPath();

BufferedReader bufferedReader = new BufferedReader(new FileReader(productSchemaFilePath));
String jsonToString = bufferedReader.lines().collect(Collectors.joining());
Expand Down

0 comments on commit c407fe3

Please sign in to comment.