Skip to content

Instantly share code, notes, and snippets.

@diogodilcl

diogodilcl/insert.py

Last active Apr 22, 2021
Embed
What would you like to do?
import json
import random
import string
import time
import uuid
import boto3
client = boto3.client('kinesis')
for _ in range(1000):
data = {
'id': str(uuid.uuid4()),
'random_number': random.randint(60, 120),
'random_string': ''.join(random.choice(string.ascii_lowercase) for i in range(10))
}
print(data)
response = client.put_record(
StreamName='data_streaming',
Data=json.dumps(data),
PartitionKey="partitionkey")
time.sleep(0.3)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment