Coder Social home page Coder Social logo

hadoop-dynamodb's Introduction

Hadoop-DynamoDB

This library provides InputFormats, OutputFormats, and Writable classes for reading and writing data to Amazon DynamoDB tables.

DynamoDB Writables

Provided are Writable implementations for the six DynamoDB Data Types. These classes are all abstract as Hadoop requires that Writable implementations must have a default constructor.

Writable Implementations:

  • NWritable
  • SWritable
  • BWritable
  • NSWritable
  • SSWritable
  • BSWritable

Defining Columns

To create a column extend one of these calsses and provide the column name to the super() constructor.

public class MyColumn extends SWritable {

    public MyColumn() {
        super("column-name");
    }

}

Defining Tables

To create a table extend DynamoDBItemWritable and pass a list of columns into the super() constructor. The first parameter must be the HashKey, the second the RangeKey, followed by any number of optional additional columns. To specify a table with only a HashKey simply pass in a null value for the RangeKey argument.

public class MyTable extends DynamoDBItemWritable {

    public static final NWritable NUMBER_COLUMN = new NWritable("n-fieldname") {};
    public static final SWritable STRING_COLUMN = new SWritable("s-fieldname") {};
    public static final BWritable BINARY_COLUMN = new BWritable("b-fieldname") {};

    public static final NSWritable NUM_SET_COLUMN = new NSWritable("ns-fieldname") {};
    public static final SSWritable STRING_SET_COLUMN = new SSWritable("ss-fieldname") {};
    public static final BSWritable BINARY_SET_COLUMN = new BSWritable("bs-fieldname") {};

    public MyTable() {
        super(
            NUMBER_COLUMN, // HashKey
            STRING_COLUMN, // RangeKey or null
            BINARY_COLUMN, // remaining column definitions
            NUM_SET_COLUMN, 
            STRING_SET_COLUMN, 
            BINARY_SET_COLUMN);
    }
	
}

Defining HashKey Table

public static final DynamoDBItemWritable MY_TABLE = new DynamoDBItemWritable(
	new NWritable("hashkey-column-name") {}, // HashKey
	null									 // range key is null
) {};

Defining a HashKey and RangeKey

public static final DynamoDBItemWritable MY_TABLE = new DynamoDBItemWritable(
	new NWritable("hashkey-column-name") {},  // HashKey
	new NWritable("rangekey-column-name") {}  // RangeKey
) {};

License

Copyright 2012 Willet Inc.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

hadoop-dynamodb's People

Watchers

 avatar

Forkers

nealclark suresk

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.