def getListFromXMLSchema(table, tag): dh = xmlSchemaParser(tag) dh.clear_attributes() parser = make_parser() #parser = setFeature(feature_namespaces, 0) dh = xmlSchemaParser(tag) parser.setContentHandler(dh) schema = py_hypertable.get_schema(table) #print schema #print schema[1] xml.sax.parseString(schema[1], dh) # items are not strings, need to convert them for ii in range(0, len(xmlSchemaParser.attributes)): xmlSchemaParser.attributes[ii] = str(xmlSchemaParser.attributes[ii]) #print xmlSchemaParser.attributes return xmlSchemaParser.attributes
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) print "expected: " + str(columns) #ret = py_hypertable.__table_exist(table_name) #print "Does table we just created exist?" #print ret ret = py_hypertable.delete_row(table_name, key) print "Deleting the key %s"%key print ret
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) print "expected: " + str(columns) #ret = py_hypertable.__table_exist(table_name) #print "Does table we just created exist?" #print ret ret = py_hypertable.delete_row(table_name, key) print "Deleting the key %s" % key print ret
import py_hypertable import string import random def GenPasswd2(length=8, chars=string.letters + string.digits): return ''.join([random.choice(chars) for i in range(length)]) 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"])
import py_hypertable import string import random def GenPasswd2(length=8, chars=string.letters + string.digits): return ''.join([random.choice(chars) for i in range(length)]) 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)