def main(): printf('*** Connect to %r database' % DBNAME) db = setup() if db not in DSNs: printf("\nERROR: %r not supported, exit" % db) return try: orm = SQLAlchemyTest(DSNs[db]) except RuntimeError: printf('\nERROR: %r not supported, exit' %db) return printf('\n*** Create users table (drop one if appl.)') orm.drop(checkfirst=True) orm.create() printf('\n*** Insert names into table') orm.insert() orm.dbDump() printf('\n*** Move users to a random group') fr, to ,num = orm.update() printf('\t(%d users moved from (%d) to (%d)' %(num, fr, to)) orm.dbDump() printf('\n*** Randomly delete group') rm, num = orm.delete() printf('\t(group #%d; %d users removed)' %(rm, num)) orm.dbDump() printf('\n*** Drop users table') orm.drop() printf('\n*** Close cxns') orm.finish()
def main(): printf("*** Connect to %r database" % DBNAME) db = setup() if db not in DSNs: printf("\nERROR: %r not supported, exit" % db) return try: orm = SQLObjectTest(DSNs[db]) except RuntimeError: printf("\nERROR: %r not supported, exit" % db) return printf("\n*** Create users table (drop old one if appl.)") Users.dropTable(True) Users.createTable() printf("\n*** Insert names into table") orm.insert() orm.dbDump() printf("\n*** Move users to a random group") fr, to, num = orm.update() printf("\t(%d users moved) from (%d) to (%d)" % (num, fr, to)) orm.dbDump() printf("\n*** Randomly delete group") rm, num = orm.delete() printf("\t(group #%d; %d users removed)" % (rm, num)) orm.dbDump() printf("\n*** Drop users table") Users.dropTable() printf("\n*** Close cxns") orm.finish()
def main(): printf('*** Connect to %r database' % DBNAME) db = setup() if db not in DSNs: printf('\nERROR: %r not supported, exit' % db) return try: orm = SQLAlchemyTest(DSNs[db]) except RuntimeError: printf('\nERROR: %r not supported, exit' % db) return printf('\n*** Create users table (drop old one if appl.)') orm.drop(checkfirst=True) orm.create() printf('\n*** Insert names into table') orm.insert() orm.dbDump() printf('\n*** Move users to a random group') fr, to, num = orm.update() printf('\t(%d users moved) from (%d) to (%d)' % (num, fr, to)) orm.dbDump() printf('\n*** Randomly delete group') rm, num = orm.delete() printf('\t(group #%d; %d users removed)' % (rm, num)) orm.dbDump() printf('\n*** Drop users table') orm.drop() printf('\n*** Close cxns') orm.finish()