cursor.executescript(line) except sqlite3.OperationalError: # Tables have been created by create_tables() but also in sql # dump. Might be best to change something so not ignoring errors continue if arguments['--manual-add']: interactive.request_drinks() if arguments['--interactive']: interactive.Run_cmd().cmdloop() if arguments['--drop']: confirm = raw_input("Confirm drop all tables?[y/N]: ") if confirm.lower() == "y": mktables.drop_tables(cursor) mktables.create_tables() if arguments['--print']: sqls.print_table(cursor, arguments['--print']) if arguments['--filename']: read_file(arguments['--filename']) if arguments['--all']: #getAvailableCocktails() if arguments['--only-stocked']: # This is hideous. I need a better way of managing my sql queries sqls.all_joins = sqls.all_joins+" where "+sqls.exist_join[:-4] sqls.print_query(cursor, sqls.all_joins) elif arguments['--ingredient']: # get a list of ingredient strings ingredients = arguments['--ingredient'].split(",") sqls.print_query(cursor, sqls.get_cocktails_with_ingredients( ingredients, restrict=arguments['--only-stocked'])) elif arguments['--drink']: drink = arguments['--drink']
def do_print(self, table, cursor=cursor): ''' prints the contents of a specified table''' sqls.print_table(cursor, table)