Skip to content

Instantly share code, notes, and snippets.

@PeterCorless
Last active September 12, 2019 15:33
Show Gist options
  • Select an option

  • Save PeterCorless/710ed6f8d090c4cac7762f62b1db2abe to your computer and use it in GitHub Desktop.

Select an option

Save PeterCorless/710ed6f8d090c4cac7762f62b1db2abe to your computer and use it in GitHub Desktop.
Scylla Alternator Gists
source:
hostURL: http://dynamodb.us-east-1.amazonaws.com
region: us-east-1
port: 8000
credentials:
accessKey: <user>
secretKey: <pass>
target:
hostURL: http://scylla-ip
port: 8000
spark-submit --class com.scylladb.migrator.DynamoDBMigrator\
--master spark://<spark-master-hostname>:7077 \
--conf spark.scylla.config=<path to config.dynamodb.yaml> <path to scylla-migrator-assembly-0.0.?.jar>
19/09/11 12:37:34 INFO AbstractDynamoDBRecordWriter: 1889407 total items written
19/09/11 12:37:48 INFO AbstractDynamoDBRecordWriter: 1888217 total items written
19/09/11 12:37:53 INFO AbstractDynamoDBRecordWriter: 2045241 total items written
19/09/11 12:38:11 INFO AbstractDynamoDBRecordWriter: 2046735 total items written
$ for i in 56 100 200 2000 80000 990000 1; do ./simple_get_value.py dynamo test$i; done
Key: test56, Attributes {'field0': 'good56'}
Key: test100, Attributes {'field0': 'good100'}
Key: test200, Attributes {'field0': 'good200'}
Key: test2000, Attributes {'field0': 'good2000'}
Key: test80000, Attributes {'field0': 'good80000'}
Key: test990000, Attributes {'field0': 'good990000'}
Key: test1, Attributes {'field0': 'good1'}
$ for i in 56 100 200 2000 80000 990000 1; do ./simple_get_value.py scylla test$i; done
Key: test56, Attributes {'field0': 'good56'}
Key: test100, Attributes {'field0': 'good100'}
Key: test200, Attributes {'field0': 'good200'}
Key: test2000, Attributes {'field0': 'good2000'}
Key: test80000, Attributes {'field0': 'good80000'}
Key: test990000, Attributes {'field0': 'good990000'}
Key: test1, Attributes {'field0': 'good1'}
#!/usr/bin/python3
import boto3
import sys
import json
aws_secret_access_key='your_secret_key'
aws_access_key_id='your_access_key'
if sys.argv[1] == "scylla":
dynamodb = boto3.resource('dynamodb',region_name='None',endpoint_url='http://52.90.208.122:8000')
else:
dynamodb = boto3.resource('dynamodb',region_name='us-east-1',aws_access_key_id=aws_access_key_id,aws_secret_access_key=aws_secret_access_key)
reply = dynamodb.batch_get_item(RequestItems={
'usertable2' : {
'Keys': [{ 'key': '%s'%(sys.argv[2]) }]
}
})
response = reply['Responses']['usertable2'][0]
print("Key: {}, Attributes {}".format(response["key"], response["attrs"]))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment