Skip to content

Commit

Permalink
Upgraded hbase to 1.9.0 (#311)
Browse files Browse the repository at this point in the history
- Updated bigtable-hbase-1.x to 1.9.0.
- Added more formatted terminal comments.
- Standardized projectID argument for Integration Test.
  • Loading branch information
rahulKQL authored and sduskis committed Feb 18, 2019
1 parent 25f01ed commit 82bb60f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -44,20 +44,25 @@ public static void main(String... args) {
// Use try-with-resources to make sure the connection is closed correctly
try (Connection connection = BigtableConfiguration.connect(projectId, instanceId)) {

System.out.println("--- Connection established with Bigtable Instance ---");
// Create a connection to the table that already exists
// Use try-with-resources to make sure the connection to the table is closed correctly
try (Table table = connection.getTable(TableName.valueOf(tableId))) {

// Read a row
String rowKey = "r1";
System.out.printf("--- Reading for row-key: %s for provided table: %s ---\n",
rowKey, tableId);

// Retrieve the result
Result result = table.get(new Get(Bytes.toBytes(rowKey)));

// Convert row data to string
String rowValue = Bytes.toString(result.value());

System.out.printf("Row r1: %s", rowValue);
System.out.printf("Scanned value for Row r1: %s \n", rowValue);

System.out.println(" --- Finished reading row --- ");

} catch (IOException e) {
// handle exception while connecting to a table
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,14 +45,15 @@
@SuppressWarnings("checkstyle:abbreviationaswordinname")
public class QuickstartIT {

private final String instanceId = System.getProperty("bigtable.test.instance");
// provide your project id as an env var
private final String projectId = System.getProperty("bigtable.test.projectID");
private final String instanceId = System.getProperty("bigtable.test.instanceID");

private final String tableId = formatForTest("my-table");
private final String columnFamilyName = "my-column-family";
private final String columnName = "my-column";
private final String data = "my-data";

// provide your project id as an env var
private final String projectId = System.getenv("GOOGLE_CLOUD_PROJECT");

private String formatForTest(String name) {
return name + "-" + UUID.randomUUID().toString().substring(0, 20);
Expand Down

0 comments on commit 82bb60f

Please sign in to comment.