public void createSimTradeTable() { CreateTableRequest createTableRequest = mapper.generateCreateTableRequest(SimDetails.class); // Table provision throughput is still required since it cannot be // specified in your POJO createTableRequest.setProvisionedThroughput(new ProvisionedThroughput(5L, 5L)); // Fire off the CreateTableRequest using the low-level client amazonDynamoDBClient.createTable(createTableRequest); }
@Before public void setUp() throws Exception { client = new AlternatorDBClientV2(); mapper = new DynamoDBMapper(client); db = new AlternatorDB().start(); CreateTableRequest request = mapper.generateCreateTableRequest(Flight.class); request.setProvisionedThroughput(new ProvisionedThroughput(10L, 5L)); client.createTable(request); }
/** * Creates the table and ignores any errors if it already exists. * * @param dynamo The Dynamo client to use. * @param createTableRequest The create table request. * @return True if created, false otherwise. */ public static final boolean createTableIfNotExists( final AmazonDynamoDB dynamo, final CreateTableRequest createTableRequest) { try { dynamo.createTable(createTableRequest); return true; } catch (final ResourceInUseException e) { if (LOG.isTraceEnabled()) { LOG.trace("Table " + createTableRequest.getTableName() + " already exists", e); } } return false; }