Skip to content

Instantly share code, notes, and snippets.

@thanakijwanavit
Last active July 14, 2021 09:22
Show Gist options
  • Save thanakijwanavit/386ff22cad50e2b03ede8f113a38cbaf to your computer and use it in GitHub Desktop.
Save thanakijwanavit/386ff22cad50e2b03ede8f113a38cbaf to your computer and use it in GitHub Desktop.
pynamodb model for uploading to dynamodb
!pip install --quiet pynamodb
from pynamodb.models import Model
from pynamodb.attributes import UnicodeAttribute, JSONAttribute
class PynamoStocks(Model):
class Meta:
# aws_access_key_id = MY_ACCESS_KEY_ID
# aws_secret_access_key = MY_SECRET_ACCESS_KEY
table_name = 'tops-inv-backlog-2'
region = 'us-east-1'
billing_mode='PAY_PER_REQUEST'
dax_read_endpoints = ['longtermcluster.vuu7lr.clustercfg.dax.apse1.cache.amazonaws.com:8111']
dax_write_endpoints = ['longtermcluster.vuu7lr.clustercfg.dax.apse1.cache.amazonaws.com:8111']
sku = UnicodeAttribute(hash_key=True)
createdDate = UnicodeAttribute(range_key=True)
product = UnicodeAttribute()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment