-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdatabase.py
More file actions
27 lines (19 loc) · 712 Bytes
/
Copy pathdatabase.py
File metadata and controls
27 lines (19 loc) · 712 Bytes
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
import boto3
import os
region = os.environ.get("REGION")
dynamodb = boto3.resource('dynamodb', region_name=region)
table = dynamodb.Table('journeysTable')
def get_journey(journey_id):
response = table.get_item(Key={'journey_id': journey_id})
journey = response.get("Item")
return journey
def put_journey(journey):
response = table.put_item(Item=journey)
return response
def update_journey(journey_id, price_by_numtix):
response = table.update_item(Key={'journey_id': journey_id},
UpdateExpression='SET price_by_numtix = :pbc',
ExpressionAttributeValues={
':pbc': price_by_numtix
})
return response