示例#1
0
def run():
    msg = request.args.get("data", "")
    cur = unquote(msg)
    result = parser.parse(cur, lexer=lexer)
    data = execute_main(result, lexer, spark, datadir)
    print(data)
    return jsonify(data)
示例#2
0
def runscript():
    script = request.args.get("data", "")
    if script:
        cur = unquote(script)
        result = parser.parse(cur, lexer=lexer)
        data = execute_main(result, lexer, spark, datadir)
        print(data)
        return jsonify(data)
    else:
        return jsonify(list(str({"data": "Invalid Input"})))
示例#3
0
def client_msg(msg):
    cur = unquote(msg["data"])
    result = parser.parse(cur, lexer=lexer)
    from execute.main import execute_main
    # execute_main(result, lexer, spark)
    data = spark.read.csv(
        "file:///Users/leiqiankun/PycharmProjects/lqkcode/tianchi/pysparkpro/test/testflask/data/tianchi_fresh_comp_train_item.csv",
        header=True)
    data.createOrReplaceTempView("A")
    datatem = spark.sql(lexer.lexdata.replace(";", ""))
    datat_response = datatem.rdd.collect()
    emit('server_response', {'data': datat_response})
示例#4
0
def client_msg(msg):
    cur = unquote(msg["data"])
    result = parser.parse(cur, lexer=lexer)
    from execute.main import execute_main
    datat_response = execute_main(result, lexer, spark)
    emit('server_response', {'data': datat_response})
示例#5
0
def exec_sql(sql, spark):
    res = parser.parse(sql, lexer=lexer)
    from execute.main import execute_main
    execute_main(res, lexer, spark)