Skip to content

Instantly share code, notes, and snippets.

@thanakijwanavit
Created August 7, 2022 03:18
Show Gist options
  • Save thanakijwanavit/59a02dda15456f3a2f9d9c94f7ba6f2d to your computer and use it in GitHub Desktop.
Save thanakijwanavit/59a02dda15456f3a2f9d9c94f7ba6f2d to your computer and use it in GitHub Desktop.
pynamodbOverride override init for pynamodb example
#export
from nicHelper.pynamodb import SuperModel
from pynamodb.attributes import JSONAttribute, NumberAttribute, UnicodeAttribute
class PaymentRecordTable(SuperModel):
data = JSONAttribute(null=True)
timestamp = NumberAttribute(hash_key=True)
userId = UnicodeAttribute()
def __init__(self, hash_key=None, range_key=None, _user_instantiated=True, **kwargs):
super().__init__(hash_key=hash_key, range_key=range_key, _user_instantiated=_user_instantiated, **kwargs)
self.timestamp = datetime.now().timestamp()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment