Spaces:
Running
Running
File size: 1,373 Bytes
83dd2a8 |
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 47 48 49 50 51 |
import boto3
# Initialize DynamoDB resource (ensure AWS credentials and region are set)
dynamodb = boto3.resource('dynamodb', region_name='us-east-1') # Change region if needed
table = dynamodb.Table('Receipts') # Replace with your table name
# List of dummy items to insert with meaningful receipt numbers
dummy_items = [
{
'receipt_no': 'RCPT-2024-0001',
'amount_paid': '100.00',
'date': '2024-01-01',
'name': 'John Doe',
'product': 'Widget A'
},
{
'receipt_no': 'RCPT-2024-0002',
'amount_paid': '250.50',
'date': '2024-02-15',
'name': 'Jane Smith',
'product': 'Gadget B'
},
{
'receipt_no': 'RCPT-2024-0003',
'amount_paid': '75.25',
'date': '2024-03-10',
'name': 'Alice Johnson',
'product': 'Thingamajig C'
},
{
'receipt_no': 'RCPT-2024-0004',
'amount_paid': '180.00',
'date': '2024-04-05',
'name': 'Bob Lee',
'product': 'Gizmo D'
},
{
'receipt_no': 'RCPT-2024-0005',
'amount_paid': '320.75',
'date': '2024-05-20',
'name': 'Carol King',
'product': 'Device E'
}
]
# Insert each item
for item in dummy_items:
table.put_item(Item=item)
print(f"Inserted: {item['receipt_no']}")
print("Dummy data inserted successfully.") |