forked from pemami2/twitterLite
-
Notifications
You must be signed in to change notification settings - Fork 0
/
DM_schema.py
executable file
·46 lines (39 loc) · 1.03 KB
/
DM_schema.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#!/usr/bin/python
import boto3
# Get the service resource.
dynamodb = boto3.resource('dynamodb',
endpoint_url='http://localhost:8000',
aws_access_key_id='fakeMyKeyId',
aws_secret_access_key='fakeSecretAccessKey')
# Create the DynamoDB table.
table = dynamodb.create_table(
TableName='Messages',
KeySchema=[
{
'AttributeName': 'To',
'KeyType': 'HASH'
},
{
'AttributeName': 'Time_From',
'KeyType': 'RANGE'
},
],
AttributeDefinitions=[
{
'AttributeName': 'To',
'AttributeType': 'S'
},
{
'AttributeName': 'Time_From',
'AttributeType': 'S'
}
],
ProvisionedThroughput={
'ReadCapacityUnits': 5,
'WriteCapacityUnits': 5
}
)
# Wait until the table exists.
table.meta.client.get_waiter('table_exists').wait(TableName='Messages')
# Print out some data about the table.
print(table.item_count)