Exemplo n.º 1
0
    '127.0.0.1',
    'gitlytics',
    'root',
    ''
)
tornado.options.enable_pretty_logging()
tornado.options.parse_command_line()

#   Create a test entity
test_entity = Entity('test_entity', 'test_id', {
    'test':'1',
    'b':'2'
}, db)

#   Create an index on test_entity for property 'test' and 'b'
test_entity.add_index(Index(test_entity, 'test', db))
test_entity.add_index(Index(test_entity, 'b', db))

#   Create Entity and Associated Index Tables
test_entity.create_table()

#   Lets create an entity without providing any data.
try:
    test = test_entity.create({})
except EntityError, e:
    print e
else:
    print 'Created Entity successfully, should of thrown error, missing index'

#   Lets actually give it the proper parameters
test = test_entity.create({