Skip to content

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 <[email protected]>

* pr fix: added dot in importproductsbigquerytable

Co-authored-by: Sita Lakshmi Sangameswaran <[email protected]>

* 🦉 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 <[email protected]>
  • Loading branch information
3 people authored Sep 26, 2022
1 parent b9ba700 commit 059da48
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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 059da48

Please sign in to comment.