def load_report_card_data(year, layout, data, flush=False, database=DEFAULT_DATABASE): with open(layout, 'rb') as f: schema = get_report_card_schema(int(year)) schema.from_file(f) with open(data, 'r') as f: loader = get_report_card_loader(int(year)) loader.set_schema(schema) load_data(loader, f, database, flush)
def create_report_card_schema(year, layout, database=DEFAULT_DATABASE, drop=False): with open(layout, 'rb') as f: schema = get_report_card_schema(int(year)) schema.from_file(f) create_tables_from_schema(schema, database, drop=drop)