Skip to content

Commit

Permalink
Merge pull request #32 from clearcare/CC-14283-allow-consolidation-of…
Browse files Browse the repository at this point in the history
…-dynamodb-writes

Allow building of DynamoDBModel without saving.
  • Loading branch information
Nesan authored Dec 12, 2016
2 parents a7eae62 + dca49be commit eb9254b
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions cc_dynamodb3/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -179,9 +179,13 @@ def query(cls, query_index=None, descending=False, limit=None, filter_expression
yield cls.from_row(row, metadata)

@classmethod
def create(cls, **kwargs):
def build(cls, **kwargs):
dynamodb_data = cls._initial_data_to_dynamodb(kwargs)
model = cls(dynamodb_data)
return cls(dynamodb_data)

@classmethod
def create(cls, **kwargs):
model = cls.build(**kwargs)
model.save(overwrite=True)
return model

Expand Down

0 comments on commit eb9254b

Please sign in to comment.