Exemplo n.º 1
0
import py_hypertable
py_hypertable = py_hypertable.DatastoreProxy()
columns = ["a","b","c"]
data = ["1","2","3"]
table_name = "hello"
key = "1"
print "key= " + key
print "columns= " + str(columns)
print "data= " + str(data)
print "table= " + table_name
print "PUT"
print py_hypertable.put_entity(table_name, key, columns, data)
print "GET"
ret = py_hypertable.get_entity(table_name, key, columns)
print "doing a put then get"
print ret
if ret[1:] != data:
  print "ERROR doing a put then get. Data does not match"
  print "returned: " + str(ret)
  print "expected: " + str(data)
  exit(1)
else: 
  print "Success"

ret = py_hypertable.get_schema("hello")
print ret
print "checking schema:"
print ret
if ret[1:] != columns:
  print "ERROR in recieved schema"
  print "returned: " + str(ret)
Exemplo n.º 2
0
print py_hypertable.get_schema("APPS__")
print py_hypertable.get_schema("USERS__")
print "does apps table exist: (should)"
print py_hypertable.__table_exist("APPS__")
print "does qwert table exist: (should not)"
print py_hypertable.__table_exist("qwerty")

table = "test_"+ GenPasswd2(10) 
print "creating table " + table + " result and adding 2 rows:"
print py_hypertable.put_entity(table, "1", ["c1","c2", "c3"], ["a1","b2","c3"])
print py_hypertable.put_entity(table, "2", ["c1","c2", "c3"], ["d4","e5","f6"])
print "does this newly table exist:"
print py_hypertable.__table_exist(table)

print "doing a get entity for row key 1:"
print py_hypertable.get_entity(table, "1", ["c1", "c2", "c3"])
print "doing a get entity for row key 2:"
print py_hypertable.get_entity(table, "2", ["c1", "c2", "c3"])
print "how many rows are in this table?"
print py_hypertable.get_row_count(table)
print "getting entire table:"
print py_hypertable.get_table(table, ["c1","c2","c3"])

print "what happens when trying to do a get on a table that doesnt exist:"
print py_hypertable.get_entity("qwerty", "1", ["a","b","c"])

print "query that table"
print py_hypertable.__query_table(table)

print "delete row from table ",table
print py_hypertable.delete_row(table, "1")
import py_hypertable
py_hypertable = py_hypertable.DatastoreProxy()
columns = ["a", "b", "c"]
data = ["1", "2", "3"]
table_name = "hello"
key = "1"
print "key= " + key
print "columns= " + str(columns)
print "data= " + str(data)
print "table= " + table_name
print "PUT"
print py_hypertable.put_entity(table_name, key, columns, data)
print "GET"
ret = py_hypertable.get_entity(table_name, key, columns)
print "doing a put then get"
print ret
if ret[1:] != data:
    print "ERROR doing a put then get. Data does not match"
    print "returned: " + str(ret)
    print "expected: " + str(data)
    exit(1)
else:
    print "Success"

ret = py_hypertable.get_schema("hello")
print ret
print "checking schema:"
print ret
if ret[1:] != columns:
    print "ERROR in recieved schema"
    print "returned: " + str(ret)
Exemplo n.º 4
0
print "does apps table exist: (should)"
print py_hypertable.__table_exist("APPS__")
print "does qwert table exist: (should not)"
print py_hypertable.__table_exist("qwerty")

table = "test_" + GenPasswd2(10)
print "creating table " + table + " result and adding 2 rows:"
print py_hypertable.put_entity(table, "1", ["c1", "c2", "c3"],
                               ["a1", "b2", "c3"])
print py_hypertable.put_entity(table, "2", ["c1", "c2", "c3"],
                               ["d4", "e5", "f6"])
print "does this newly table exist:"
print py_hypertable.__table_exist(table)

print "doing a get entity for row key 1:"
print py_hypertable.get_entity(table, "1", ["c1", "c2", "c3"])
print "doing a get entity for row key 2:"
print py_hypertable.get_entity(table, "2", ["c1", "c2", "c3"])
print "how many rows are in this table?"
print py_hypertable.get_row_count(table)
print "getting entire table:"
print py_hypertable.get_table(table, ["c1", "c2", "c3"])

print "what happens when trying to do a get on a table that doesnt exist:"
print py_hypertable.get_entity("qwerty", "1", ["a", "b", "c"])

print "query that table"
print py_hypertable.__query_table(table)

print "delete row from table ", table
print py_hypertable.delete_row(table, "1")