def bulk_insert_scores(file_ref, table): # this is the only way I can get --local-infile flag to work with python f=os.path.abspath(file_ref) stmt = "load data local infile '{}' into table {} fields terminated by '\\t';".format(f, table) info = connection_info() cmd = ["mysql", info['database'], "-u{}".format(info['user']), "-p{}".format(info['password']), "-h{}".format(info['host']), "--local-infile", "-e", "{}".format(stmt)] #print " ".join(cmd) subprocess.call(cmd)
def newman_connector(): return mysql_connector(**connection_info())
def query_obj(statement='', args=()): return dict(connection_info(), **{'statement': statement, 'prepared_args': args})