Skip to content

Instantly share code, notes, and snippets.

@yasudacloud
Created April 7, 2023 13:13
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 yasudacloud/c04cbfa20ebe2bd787ba4e5cb61f5ea3 to your computer and use it in GitHub Desktop.
Save yasudacloud/c04cbfa20ebe2bd787ba4e5cb61f5ea3 to your computer and use it in GitHub Desktop.
con = Connection(region='ap-northeast-1', host="http://localhost:8000")
now = datetime.now()
sample1 = Sample(sample_id='1001', text='hello1', created=now)
sample2 = Sample(sample_id='1002', text='hello2', created=now)
try:
with TransactWrite(connection=con) as transaction:
transaction.save(sample1)
transaction.save(sample2)
except TransactWriteError as e:
print(e)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment