accumulo-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] keith-turner commented on a change in pull request #35: ACCUMULO-4734 Content for getting-started and basic-read-write
Date Thu, 01 Jan 1970 00:00:00 GMT
keith-turner commented on a change in pull request #35: ACCUMULO-4734 Content for getting-started
and basic-read-write
URL: https://github.com/apache/accumulo-website/pull/35#discussion_r149172362
 
 

 ##########
 File path: tour/basic-read-write.md
 ##########
 @@ -1,5 +1,61 @@
 ---
-title: Basic Reading & Writing
+title: Writing and Reading
 ---
+Accumulo is a big data key/value store.  Writing data to Accumulo is flexible and fast. 
Like any database, Accumulo stores
+data in tables and rows.  Each row in an Accumulo table can hold many key/value pairs.  
 
-Talk about reading and writing.
+Copy and paste the code below into the _exercise_  method.
+```java
+        // 1. Start by connecting to Mini Accumulo as the root user and create a table called
"superheroes".
+        Connector conn = mac.getConnector("root", "tourguide");
+        conn.tableOperations().create("superheroes");
+
+        // 2. Create a Mutation object to write to a row
+        Mutation mutation = new Mutation("hero023948092");
+        // A Mutation is an object that holds all changes to a row in a table.  Each row
has a unique row ID.
+
+        // 3. Create key/value pairs for Batman.  Put them in the "HeroAttribute" family.
+        mutation.put("HeroAttribute","name", "Batman");
+        mutation.put("HeroAttribute","real-name", "Bruce Wayne");
+        mutation.put("HeroAttribute","wearsCape?", "true");
+        mutation.put("HeroAttribute","flies?","false");
+
+        // 4. Create a BatchWriter to the superhero table and add your mutation to it.  Try
w/ resources will close for us.
+        try(BatchWriter writer = conn.createBatchWriter("superheroes", new BatchWriterConfig()))
{
+            writer.addMutation(mutation);
+        } catch(TableNotFoundException | MutationsRejectedException e) {
 
 Review comment:
   I think it would be nice to make the exercise method throw Exception and drop this catch
block.  Doing this makes this first bit of code someone sees shorter, which I think is important.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

Mime
View raw message