Skip to content

Instantly share code, notes, and snippets.

@NeuroWinter
Created March 18, 2018 01:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save NeuroWinter/711572d3b3e2b4380a56f2d65701e89a to your computer and use it in GitHub Desktop.
Save NeuroWinter/711572d3b3e2b4380a56f2d65701e89a to your computer and use it in GitHub Desktop.
import boto3
import time
from datetime import datetime, timedelta
from boto3.dynamodb.conditions import Key, Attr
dynamodb = boto3.resource('dynamodb')
table = dynamodb.Table('table_name')
now = int(datetime.timestamp(datetime.now()))
three_hours_ago = int(datetime.timestamp(datetime.now() - timedelta(hours=3)))
fe = Key('timeStamp').between(three_hours_ago,now);
response = table.scan(
FilterExpression=fe
)
print(response)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment