Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Docs] GCloud: Add BigQuery Client creation #7528

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions docs/modules/gcloud.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@ Start BigQuery Emulator during a test:
[Starting a BigQuery Emulator container](../../modules/gcloud/src/test/java/org/testcontainers/containers/BigQueryEmulatorContainerTest.java) inside_block:emulatorContainer
<!--/codeinclude-->

<!--codeinclude-->
[Creating BigQuery Client](../../modules/gcloud/src/test/java/org/testcontainers/containers/BigQueryEmulatorContainerTest.java) inside_block:bigQueryClient
<!--/codeinclude-->

### Bigtable

Start Bigtable Emulator during a test:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package org.testcontainers.containers;

import com.google.cloud.NoCredentials;
import com.google.cloud.bigquery.BigQuery;
import com.google.cloud.bigquery.BigQueryOptions;
import com.google.cloud.bigquery.QueryJobConfiguration;
Expand All @@ -23,14 +24,17 @@ public void test() throws Exception {
) {
container.start();

// bigQueryClient {
String url = container.getEmulatorHttpEndpoint();
BigQueryOptions options = BigQueryOptions
.newBuilder()
.setProjectId(container.getProjectId())
.setHost(url)
.setLocation(url)
.setCredentials(NoCredentials.getInstance())
.build();
BigQuery bigQuery = options.getService();
// }

String fn =
"CREATE FUNCTION testr(arr ARRAY<STRUCT<name STRING, val INT64>>) AS ((SELECT SUM(IF(elem.name = \"foo\",elem.val,null)) FROM UNNEST(arr) AS elem))";
Expand Down
Loading