本文整理了Java中com.amazonaws.services.dynamodbv2.document.DynamoDB.createTable()
方法的一些代码示例,展示了DynamoDB.createTable()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。DynamoDB.createTable()
方法的具体详情如下:
包路径:com.amazonaws.services.dynamodbv2.document.DynamoDB
类名称:DynamoDB
方法名:createTable
[英]Creates the specified table in DynamoDB.
[中]在DynamoDB中创建指定的表。
代码示例来源:origin: aws/aws-sdk-java
/**
* Creates the specified table in DynamoDB.
*/
public Table createTable(String tableName,
List<KeySchemaElement> keySchema,
List<AttributeDefinition> attributeDefinitions,
ProvisionedThroughput provisionedThroughput) {
return createTable(new CreateTableRequest()
.withTableName(tableName)
.withKeySchema(keySchema)
.withAttributeDefinitions(attributeDefinitions)
.withProvisionedThroughput(provisionedThroughput));
}
代码示例来源:origin: stackoverflow.com
public static final AmazonDynamoDBClient DYNAMODB_CLIENT = new AmazonDynamoDBClient(CREDENTIALS_PROVIDER);
public static final DynamoDB DYNAMODB = new DynamoDB(DYNAMODB_CLIENT);
...
Table table = DYNAMODB.createTable(request);
table.waitForActive();
代码示例来源:origin: com.amazonaws/aws-java-sdk-dynamodb
/**
* Creates the specified table in DynamoDB.
*/
public Table createTable(String tableName,
List<KeySchemaElement> keySchema,
List<AttributeDefinition> attributeDefinitions,
ProvisionedThroughput provisionedThroughput) {
return createTable(new CreateTableRequest()
.withTableName(tableName)
.withKeySchema(keySchema)
.withAttributeDefinitions(attributeDefinitions)
.withProvisionedThroughput(provisionedThroughput));
}
代码示例来源:origin: aws-samples/aws-dynamodb-examples
static void createExampleTable() {
try {
ArrayList<AttributeDefinition> attributeDefinitions = new ArrayList<AttributeDefinition>();
attributeDefinitions.add(new AttributeDefinition()
.withAttributeName("Id")
.withAttributeType("N"));
ArrayList<KeySchemaElement> keySchema = new ArrayList<KeySchemaElement>();
keySchema.add(new KeySchemaElement()
.withAttributeName("Id")
.withKeyType(KeyType.HASH));
CreateTableRequest request = new CreateTableRequest()
.withTableName(tableName)
.withKeySchema(keySchema)
.withAttributeDefinitions(attributeDefinitions)
.withProvisionedThroughput(new ProvisionedThroughput()
.withReadCapacityUnits(5L)
.withWriteCapacityUnits(6L));
System.out.println("Issuing CreateTable request for " + tableName);
Table table = dynamoDB.createTable(request);
System.out.println("Waiting for " + tableName
+ " to be created...this may take a while...");
table.waitForActive();
getTableInformation();
} catch (Exception e) {
System.err.println("CreateTable request failed for " + tableName);
System.err.println(e.getMessage());
}
}
代码示例来源:origin: aws-samples/aws-dynamodb-examples
Table table = dynamoDB.createTable(tableName,
keySchema,
attributeDefinitions,
代码示例来源:origin: aws-samples/aws-dynamodb-examples
public static void main(String[] args) throws Exception {
AmazonDynamoDBClient client = new AmazonDynamoDBClient();
client.setEndpoint("http://localhost:8000");
DynamoDB dynamoDB = new DynamoDB(client);
String tableName = "Movies";
Table table = dynamoDB.createTable(tableName,
Arrays.asList(
new KeySchemaElement("year", KeyType.HASH),
new KeySchemaElement("title", KeyType.RANGE)),
Arrays.asList(
new AttributeDefinition("year", ScalarAttributeType.N),
new AttributeDefinition("title", ScalarAttributeType.S)),
new ProvisionedThroughput(10L, 10L));
try {
TableUtils.waitUntilActive(client, tableName);
System.out.println("Table status: " + table.getDescription().getTableStatus());
} catch (AmazonClientException e) {
e.printStackTrace();
System.exit(1);
}
}
}
代码示例来源:origin: org.apache.hadoop/hadoop-aws
LOG.info("Creating non-existent DynamoDB table {} in region {}",
tableName, region);
table = dynamoDB.createTable(new CreateTableRequest()
.withTableName(tableName)
.withKeySchema(keySchema())
代码示例来源:origin: stackoverflow.com
.withGlobalSecondaryIndexes(videoCategoryGsi);
Table table = dynamoDB.createTable(createTableRequest);
代码示例来源:origin: johnewart/gearman-java
Table table = dynamoDB.createTable(request);
代码示例来源:origin: com.nimbusds/infinispan-cachestore-dynamodb
table = new DynamoDB(client).createTable(requestFactory
.resolveCreateTableRequest()
.withProvisionedThroughput(
代码示例来源:origin: telefonicaid/fiware-cygnus
Table table = dynamoDB.createTable(tableRequest);
代码示例来源:origin: aws-samples/aws-dynamodb-examples
Table table = dynamoDB.createTable(request);
System.out.println("Waiting for " + tableName
+ " to be created...this may take a while...");
代码示例来源:origin: aws-samples/aws-dynamodb-examples
System.out.println(dynamoDB.createTable(createTableRequest));
代码示例来源:origin: org.wildfly.camel/wildfly-camel-itests-common
public static TableDescription createTable(AmazonDynamoDB client, String tableName) throws InterruptedException {
CreateTableRequest tableReq = new CreateTableRequest().withTableName(tableName)
.withKeySchema(new KeySchemaElement("Id", KeyType.HASH))
.withAttributeDefinitions(new AttributeDefinition("Id", ScalarAttributeType.N))
.withProvisionedThroughput(new ProvisionedThroughput(10L, 10L))
.withStreamSpecification(new StreamSpecification().withStreamEnabled(true).withStreamViewType(StreamViewType.NEW_AND_OLD_IMAGES));
DynamoDB dynamoDB = new DynamoDB(client);
Table table = dynamoDB.createTable(tableReq);
return table.waitForActive();
}
代码示例来源:origin: wildfly-extras/wildfly-camel
public static TableDescription createTable(AmazonDynamoDB client, String tableName) throws InterruptedException {
CreateTableRequest tableReq = new CreateTableRequest().withTableName(tableName)
.withKeySchema(new KeySchemaElement("Id", KeyType.HASH))
.withAttributeDefinitions(new AttributeDefinition("Id", ScalarAttributeType.N))
.withProvisionedThroughput(new ProvisionedThroughput(10L, 10L))
.withStreamSpecification(new StreamSpecification().withStreamEnabled(true).withStreamViewType(StreamViewType.NEW_AND_OLD_IMAGES));
DynamoDB dynamoDB = new DynamoDB(client);
Table table = dynamoDB.createTable(tableReq);
return table.waitForActive();
}
代码示例来源:origin: aws-samples/aws-dynamodb-examples
dynamoDB.createTable(createTableRequest);
内容来源于网络,如有侵权,请联系作者删除!