This is the main documentation for the gora-dynamodb module. gora-dynamodb module enables Amazon DynamoDB backend support for Gora.
gora.datastore.default=org.apache.gora.dynamodb.store.DynamoDBStore
gora.datastore.autocreateschema=true
preferred.schema.name=Person
gora.dynamodb.mapping.file=/path/to/gora-dynamodb-mapping.xml
gora.dynamodb.client=sync
gora.dynamodb.consistent.reads=true
gora.dynamodb.endpoint=http://dynamodb.ap-northeast-1.amazonaws.com/
gora.dynamodb.serialization.type=dynamo
Property Key | Property Value | Required | Description |
---|---|---|---|
gora.datastore.default | org.apache.gora.dynamodb.store.DynamoDBStore | Yes | Implementation of the storage class |
gora.datastore.autocreateschema | true | No | Create the table if it doesn’t exist |
preferred.schema.name | Person | Yes | Name of the DynamoDB table/schema |
gora.dynamodb.mapping.file | /path/to/gora-dynamodb-mapping.xml | No | The XML mapping file to be used. Defaults to gora-dynamodb-mapping.xml |
gora.dynamodb.client | sync | No | DynamoDB client type. It could be sync or async. |
gora.dynamodb.consistent.reads | true | No | Default is eventual consistence i.e. false. |
gora.dynamodb.endpoint | http://dynamodb.us-east-1.amazonaws.com/ | Yes | Set to geographically closest service endpoint. For accepted list, see here |
gora.dynamodb.serialization.type | dynamo | No | Data store serialization type. It could be 'dynamo' or 'avro' |
Say we wished to map some user data and store it into DynamoDB.
<gora-otd>
<table name="Person" readcunit="1" writecunit="1" package="org.apache.gora.dynamodb.example.generated">
<attribute name="ssn" type="N" key="hash"/>
<attribute name="date" type="S" key="hashrange"/>
<attribute name="firstName" type="S"/>
<attribute name="lastName" type="S"/>
<attribute name="salary" type="N"/>
<attribute name="visitedplaces" type="SS"/>
</gora-otd>
Within the gora-otd
mapping configuration, only the 'table' child element is required.
name
(String) e.g. Personreadcunit
(Number) e.g. 1 More about them herewritecunit
(Number) e.g. 1package
having the table (String)name
e.g. name, dateOfBirth, ssn and salarytype
to which they belong e.g. (B/L/M/N/S/SS). For more, refer herekey
. The key can be a hash key (partition key/primary key) or a hashrange key (sort key) (in case of composite primary key). The key parameter is left blank for non-key attributes. For more, refer here