GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Bigtable Java samples by elisheva-qlogic · Pull Request #3946 · googleapis/google-cloud-java

Conversation

@elisheva-qlogic

@elisheva-qlogic elisheva-qlogic commented Nov 15, 2018

Copy link
Copy Markdown
Contributor

HelloWorld, TableAdmin, and InstanceAdmin examples

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@elisheva-qlogic
elisheva-qlogic requested a review from a team November 15, 2018 15:28
@googlebot googlebot added the cla: yes This human has signed the Contributor License Agreement. label Nov 15, 2018
igorbernstein2
igorbernstein2 reviewed Nov 15, 2018
View reviewed changes

@igorbernstein2 igorbernstein2 left a comment

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a good start, I added some comments, but didn't do a full review. Can you help me understand how samples work? how/who uses the comment tags? What are snippets? Why are other products differentiate between examples and snippets?

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread google-cloud-examples/src/main/java/com/google/cloud/examples/bigtable/HelloWorld.java Outdated
import com.google.cloud.bigtable.data.v2.models.RowMutation;
import java.sql.Timestamp;

// [START HelloWorld]

This comment was marked as spam.

Sign in to view

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

This comment was marked as spam.

Sign in to view

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

This comment was marked as spam.

Sign in to view

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

Comment thread google-cloud-examples/src/main/java/com/google/cloud/examples/bigtable/HelloWorld.java Outdated
String COLUMN_FAMILY_ID = "cf1";
String COLUMN_QUALIFIER = "greeting";
String INSTANCE_ID = System.getenv("INSTANCE_ID");
String GCLOUD_PROJECT_ID = System.getenv("GCLOUD_PROJECT_ID");

This comment was marked as spam.

Sign in to view

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

Comment thread google-cloud-examples/src/main/java/com/google/cloud/examples/bigtable/HelloWorld.java Outdated
String COLUMN_FAMILY_ID = "cf1";
String COLUMN_QUALIFIER = "greeting";
String INSTANCE_ID = System.getenv("INSTANCE_ID");
String GCLOUD_PROJECT_ID = System.getenv("GCLOUD_PROJECT_ID");

This comment was marked as spam.

Sign in to view

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

Comment thread google-cloud-examples/src/main/java/com/google/cloud/examples/bigtable/HelloWorld.java Outdated

try {
System.out.println("Write some greetings to the table");
String[] greetings = { "Hello World!", "Hello Bigtable!", "Hello Node!" };

This comment was marked as spam.

Sign in to view

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

Comment thread google-cloud-examples/src/main/java/com/google/cloud/examples/bigtable/HelloWorld.java Outdated
String[] greetings = { "Hello World!", "Hello Bigtable!", "Hello Node!" };
for (int i = 0; i < greetings.length; i++) {
RowMutation rowMutation = RowMutation.create(TABLE_ID, rowKeyPrefix + i);
long timestamp = new Timestamp(System.currentTimeMillis()).getTime();

This comment was marked as spam.

Sign in to view

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

Comment thread google-cloud-examples/src/main/java/com/google/cloud/examples/bigtable/InstanceAdmin.java Outdated
.println("PRODUCTION type instance : " + instance.getId() + " created successfully");

} catch (Exception e) {
System.out.println("Error creating prod-instance: " + e.getMessage());

This comment was marked as spam.

Sign in to view

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

Comment thread google-cloud-examples/src/main/java/com/google/cloud/examples/bigtable/InstanceAdmin.java Outdated
deleteCluster(adminClient, "ssd-instance", "ssd-cluster");

// end operations with deleting the pro-instance created in `runInstanceOperations`
deleteInstance(adminClient, "ssd-instance");

This comment was marked as spam.

Sign in to view

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

Comment thread google-cloud-examples/src/main/java/com/google/cloud/examples/bigtable/InstanceAdmin.java Outdated
BigtableInstanceAdminClient.create(instanceAdminSettings);

System.out.println("Create an instance (type: PRODUCTION) and run basic instance-operations");
runInstanceOperations(adminClient, "ssd-instance", "ssd-cluster");

This comment was marked as spam.

Sign in to view

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

Comment thread google-cloud-examples/src/main/java/com/google/cloud/examples/bigtable/InstanceAdmin.java Outdated
System.out.println("Delete the Instance");
deleteInstance(adminClient, "hdd-instance");

System.out.println("Add Cluster");

This comment was marked as spam.

Sign in to view

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

Comment thread google-cloud-examples/src/main/java/com/google/cloud/examples/bigtable/InstanceAdmin.java Outdated
try {
adminClient.deleteInstance(instanceID);
System.out.println("Instance deleted: " + instanceID);
} catch (Exception e) {

This comment was marked as spam.

Sign in to view

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@sduskis sduskis changed the title Java samples Bigtable Java samples Nov 15, 2018
@sduskis

sduskis commented Nov 15, 2018

Copy link
Copy Markdown
Contributor

@igorbernstein2, the snippets are used in https://cloud.google.com/bigtable/docs/. Our documentation has a tool to pull in code based on the tags

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@igorbernstein2

igorbernstein2 commented Nov 15, 2018

Copy link
Copy Markdown
Contributor

Also, to @chingor13 comment, it would be good to add tests to make sure these snippets continue to work

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@sduskis

sduskis commented Dec 4, 2018

Copy link
Copy Markdown
Contributor

@elisheva-qlogic, there's a build failure:

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.5.1:compile (default-compile) on project google-cloud-examples: Compilation failure
[ERROR] /tmpfs/src/github/google-cloud-java/google-cloud-examples/src/main/java/com/google/cloud/examples/bigtable/TableAdmin.java:[56,60] incompatible types
[ERROR]   required: java.util.List<com.google.bigtable.admin.v2.TableName>
[ERROR]   found:    java.util.List<java.lang.String>
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@elisheva-qlogic
elisheva-qlogic force-pushed the samples branch from 4f20ff6 to 514b3ab Compare December 6, 2018 21:29
elisheva-qlogic added 7 commits December 19, 2018 09:21
@elisheva-qlogic
Java samples
b24d42f
@elisheva-qlogic
Samples and tests
7932079
@elisheva-qlogic
samples fixes
13b5c1c
@elisheva-qlogic
code format fix
a5231c3
@elisheva-qlogic
HelloWorld changes
adcafd0
@elisheva-qlogic
system property for tests set up
5cc4f15
@elisheva-qlogic
code format changes
7ad20e5
@elisheva-qlogic
elisheva-qlogic force-pushed the samples branch from 4f35dbf to 7ad20e5 Compare December 19, 2018 14:29
igorbernstein2
igorbernstein2 requested changes Dec 19, 2018
View reviewed changes

@igorbernstein2 igorbernstein2 left a comment •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this sample should be restructured a bit

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread google-cloud-examples/src/main/java/com/google/cloud/examples/bigtable/HelloWorld.java Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread google-cloud-examples/src/main/java/com/google/cloud/examples/bigtable/HelloWorld.java Outdated
String TABLE_ID,
String ROW_KEY_PREFIX,
String COLUMN_FAMILY_ID,
String COLUMN_QUALIFIER) {

This comment was marked as spam.

Sign in to view

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

Comment thread google-cloud-examples/src/main/java/com/google/cloud/examples/bigtable/HelloWorld.java Outdated
dataClient.mutateRow(rowMutation);
System.out.println(greetings[i]);
}
} catch (Exception e) {

This comment was marked as spam.

Sign in to view

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

Comment thread google-cloud-examples/src/main/java/com/google/cloud/examples/bigtable/HelloWorld.java Outdated
System.out.println(greetings[i]);
}
} catch (Exception e) {
System.out.println("Exception while writing to table: " + e.getMessage());

This comment was marked as spam.

Sign in to view

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

Comment thread google-cloud-examples/src/main/java/com/google/cloud/examples/bigtable/HelloWorld.java Outdated
} catch (Exception e) {
System.out.println("Exception while writing to table: " + e.getMessage());
}
return mutation;

This comment was marked as spam.

Sign in to view

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

This comment was marked as spam.

Sign in to view

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

This comment was marked as spam.

Sign in to view

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

This comment was marked as spam.

Sign in to view

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

This comment was marked as spam.

Sign in to view

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

Comment thread google-cloud-examples/src/main/java/com/google/cloud/examples/bigtable/HelloWorld.java Outdated
} catch (Exception e) {
System.out.println("Exception while reading table: " + e.getMessage());
}
return rowStream;

This comment was marked as spam.

Sign in to view

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

Comment thread google-cloud-examples/src/main/java/com/google/cloud/examples/bigtable/HelloWorld.java Outdated
}

public static Table createTable(
BigtableTableAdminClient adminClient, String TABLE_ID, String COLUMN_FAMILY_ID) {

This comment was marked as spam.

Sign in to view

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

Comment thread google-cloud-examples/src/main/java/com/google/cloud/examples/bigtable/HelloWorld.java Outdated

public class HelloWorld {

public static void main(String... args) throws Exception {

This comment was marked as spam.

Sign in to view

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

This comment was marked as spam.

Sign in to view

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

This comment was marked as spam.

Sign in to view

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

This comment was marked as spam.

Sign in to view

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

Comment thread google-cloud-examples/src/main/java/com/google/cloud/examples/bigtable/TableAdmin.java Outdated

final String GCLOUD_PROJECT = args[0];
final String INSTANCE_ID = args[1];
final String TABLE_ID = "table";

This comment was marked as spam.

Sign in to view

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

Comment thread google-cloud-examples/src/test/java/com/google/cloud/examples/bigtable/HelloWorldTest.java
private static final String ROW_KEY_PREFIX = "test-rowKey";
private static BigtableDataClient dataClient;
private static BigtableTableAdminClient adminClient;

This comment was marked as spam.

Sign in to view

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@elisheva-qlogic
changes
e57bb89
@elisheva-qlogic

elisheva-qlogic commented Dec 24, 2018

Copy link
Copy Markdown
Contributor Author

The main change is that HelloWorld sample is restructured. If this looks good, I will work on restructuring TableAdmin and InstanceAdmin samples like this as well.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

igorbernstein2
igorbernstein2 requested changes Dec 24, 2018
View reviewed changes
Comment thread google-cloud-examples/src/main/java/com/google/cloud/examples/bigtable/HelloWorld.java Outdated
private static String instanceId;
private static String tableId;
private static BigtableDataClient dataClient;
private static BigtableTableAdminClient adminClient;

This comment was marked as spam.

Sign in to view

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

Comment thread google-cloud-examples/src/main/java/com/google/cloud/examples/bigtable/HelloWorld.java Outdated
deleteTable();
garbageCollect();
} catch (ApiException e) {
System.err.println("Exception while running HelloWorld: " + e.getMessage());

This comment was marked as spam.

Sign in to view

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

Comment thread google-cloud-examples/src/main/java/com/google/cloud/examples/bigtable/HelloWorld.java
// [END connecting_to_bigtable]
}

public void run() throws Exception {

This comment was marked as spam.

Sign in to view

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

This comment was marked as spam.

Sign in to view

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

Comment thread google-cloud-examples/src/main/java/com/google/cloud/examples/bigtable/HelloWorld.java
if (!adminClient.exists(tableId)) {
CreateTableRequest createTableRequest =
CreateTableRequest.of(tableId).addFamily(columnFamily);
System.out.println("Creating table: " + tableId);

This comment was marked as spam.

Sign in to view

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

Comment thread google-cloud-examples/src/main/java/com/google/cloud/examples/bigtable/HelloWorld.java Outdated
private static final String tablePrefix = "table";
private static final String columnFamily = "cf1";
private static final String columnQualifier = "greeting";
private static final String rowKeyPrefix = "rowKey";

This comment was marked as spam.

Sign in to view

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

Comment thread google-cloud-examples/src/main/java/com/google/cloud/examples/bigtable/HelloWorld.java Outdated
dataClient.mutateRow(rowMutation);
System.out.println(greetings[i]);
}
} catch (ApiException e) {

This comment was marked as spam.

Sign in to view

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

This comment was marked as spam.

Sign in to view

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

This comment was marked as spam.

Sign in to view

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

Comment thread google-cloud-examples/src/main/java/com/google/cloud/examples/bigtable/HelloWorld.java Outdated
public void readTable() {
// [START scanning_all_rows]
try {
System.out.println("\n================= Reading the entire table =================");

This comment was marked as spam.

Sign in to view

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

Comment thread google-cloud-examples/src/main/java/com/google/cloud/examples/bigtable/HelloWorld.java
adminClient.deleteTable(tableId);
}
}
}

This comment was marked as spam.

Sign in to view

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

elisheva-qlogic added 2 commits December 27, 2018 15:22
@elisheva-qlogic
HelloWorld updates
b8b4f22
@elisheva-qlogic
exceptions specified
99b5c63
igorbernstein2
igorbernstein2 reviewed Dec 28, 2018
View reviewed changes
Comment thread google-cloud-examples/src/main/java/com/google/cloud/examples/bigtable/HelloWorld.java
System.out.println(greetings[i]);
}
} catch (NotFoundException e) {
System.err.println("Exception while writing to table: " + e.getMessage());

This comment was marked as spam.

Sign in to view

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

igorbernstein2
igorbernstein2 reviewed Dec 28, 2018
View reviewed changes
Comment thread google-cloud-examples/src/test/java/com/google/cloud/examples/bigtable/ITHelloWorld.java
}
tableId = generateTableId();
helloWorld = new HelloWorld(instanceName.getProject(), instanceName.getInstance(), tableId);
if (!adminClient.exists(tableId)) {

This comment was marked as spam.

Sign in to view

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

This comment was marked as spam.

Sign in to view

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

igorbernstein2
igorbernstein2 reviewed Dec 28, 2018
View reviewed changes
Comment thread google-cloud-examples/src/test/java/com/google/cloud/examples/bigtable/ITHelloWorld.java

// Read a single row
OutputStream outputStream = new ByteArrayOutputStream();
System.setOut(new PrintStream(outputStream));

This comment was marked as spam.

Sign in to view

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

This comment was marked as spam.

Sign in to view

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@sduskis

sduskis commented Jan 2, 2019

Copy link
Copy Markdown
Contributor

Closing this in favor of #4274

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@sduskis sduskis closed this Jan 2, 2019
chingor13 pushed a commit that referenced this pull request Mar 24, 2026
@lqiu96
deps: Upgrade Google Http Java Client to v2.0.2 (#3946)
89d518c
chingor13 pushed a commit that referenced this pull request Mar 24, 2026
@release-please
chore(main): release 2.63.0 (#3927)
588b428
🤖 I have created a release *beep* *boop*
---


<details><summary>2.63.0</summary>

##
[2.63.0](googleapis/sdk-platform-java@v2.62.3...v2.63.0)
(2025-10-16)


### Features

* **librariangen:** add bazel package
([#3940](googleapis/sdk-platform-java#3940))
([d6bd0e0](googleapis/sdk-platform-java@d6bd0e0))
* **librariangen:** add execv package
([#3932](googleapis/sdk-platform-java#3932))
([7fc08a5](googleapis/sdk-platform-java@7fc08a5))
* **librariangen:** add protoc package
([#3935](googleapis/sdk-platform-java#3935))
([c3f7b9f](googleapis/sdk-platform-java@c3f7b9f))
* **librariangen:** add request package
([#3933](googleapis/sdk-platform-java#3933))
([c478a98](googleapis/sdk-platform-java@c478a98))
* **librariangen:** scaffold Java language container for Librarian
([#3926](googleapis/sdk-platform-java#3926))
([aec74aa](googleapis/sdk-platform-java@aec74aa))


### Dependencies

* Bump errorprone-annotations to v2.42.0
([4fa48a2](googleapis/sdk-platform-java@4fa48a2))
* Bump guava to v33.5.0
([4fa48a2](googleapis/sdk-platform-java@4fa48a2))
* Bump j2objc-annotations to v3.1
([4fa48a2](googleapis/sdk-platform-java@4fa48a2))
* update google auth library dependencies to v1.40.0
([#3945](googleapis/sdk-platform-java#3945))
([4b2c98e](googleapis/sdk-platform-java@4b2c98e))
* Upgrade Google Http Java Client to v2.0.2
([#3946](googleapis/sdk-platform-java#3946))
([89d518c](googleapis/sdk-platform-java@89d518c))
</details>

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@chingor13 chingor13 chingor13 left review comments
@igorbernstein2 igorbernstein2 igorbernstein2 requested changes
+1 more reviewer
@sduskis sduskis sduskis left review comments
Reviewers whose approvals may not affect merge requirements

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

cla: yes This human has signed the Contributor License Agreement.

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

5 participants

@elisheva-qlogic @sduskis @igorbernstein2 @chingor13 @googlebot
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.