From c78a8cd3c96a7704f3ef295b383d013d5a2c9db2 Mon Sep 17 00:00:00 2001 From: dfirova <93149631+dfirova@users.noreply.github.com> Date: Mon, 26 Sep 2022 13:54:52 +0300 Subject: [PATCH] fix(samples): bug fix for removing buckets from bq. (#548) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * 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 * pr fix: added dot in importproductsbigquerytable Co-authored-by: Sita Lakshmi Sangameswaran * 🦉 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 Co-authored-by: Sita Lakshmi Sangameswaran --- .../src/main/java/product/ImportProductsBigQueryTable.java | 7 +++++-- .../java/product/setup/ProductsCreateBigqueryTable.java | 2 +- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/retail/interactive-tutorials/src/main/java/product/ImportProductsBigQueryTable.java b/retail/interactive-tutorials/src/main/java/product/ImportProductsBigQueryTable.java index 552751cffdd..83dce027efe 100644 --- a/retail/interactive-tutorials/src/main/java/product/ImportProductsBigQueryTable.java +++ b/retail/interactive-tutorials/src/main/java/product/ImportProductsBigQueryTable.java @@ -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); } diff --git a/retail/interactive-tutorials/src/main/java/product/setup/ProductsCreateBigqueryTable.java b/retail/interactive-tutorials/src/main/java/product/setup/ProductsCreateBigqueryTable.java index a13c0b8dc48..2463622af20 100644 --- a/retail/interactive-tutorials/src/main/java/product/setup/ProductsCreateBigqueryTable.java +++ b/retail/interactive-tutorials/src/main/java/product/setup/ProductsCreateBigqueryTable.java @@ -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());