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)
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"})))
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})
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})
def exec_sql(sql, spark): res = parser.parse(sql, lexer=lexer) from execute.main import execute_main execute_main(res, lexer, spark)