Skip to content

Instantly share code, notes, and snippets.

@jlafon
Created May 7, 2014 15:49
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 jlafon/28b0ae2e50435dbd5e13 to your computer and use it in GitHub Desktop.
Save jlafon/28b0ae2e50435dbd5e13 to your computer and use it in GitHub Desktop.
Issue 20
from __future__ import print_function
import logging
from pynamodb.models import Model
from pynamodb.attributes import (UnicodeAttribute)
logging.basicConfig()
log = logging.getLogger("")
log.setLevel(logging.DEBUG)
log.propagate = True
class TestModel(Model):
class Meta:
host = 'http://localhost:8000'
region = 'us-east-1'
table_name = 'pynamo-test-table'
table_key = UnicodeAttribute(hash_key=True)
table_string_field = UnicodeAttribute(default='')
if __name__ == "__main__":
if not TestModel.exists():
TestModel.create_table(read_capacity_units=2, write_capacity_units=1,
wait=True)
result = TestModel.get('Nonexistent')
print(result)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment