Пример #1
0
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)
Пример #2
0
def newman_connector():
    return mysql_connector(**connection_info())
Пример #3
0
def newman_connector():
    return mysql_connector(**connection_info())
Пример #4
0
def query_obj(statement='', args=()):
    return dict(connection_info(), **{'statement': statement, 'prepared_args': args})