From 06f2e1c990c4f9573a408ff4bb60d95fc75b814c Mon Sep 17 00:00:00 2001 From: guange <8863824@gmail.com> Date: Fri, 18 Jan 2019 15:23:00 +0800 Subject: [PATCH] . --- chapter3/spark.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/chapter3/spark.py b/chapter3/spark.py index f86ba98..5e51f27 100644 --- a/chapter3/spark.py +++ b/chapter3/spark.py @@ -92,7 +92,7 @@ def collect_from_type(spark): for row in df.rdd.collect(): if row["from_type"]: data[row["from_type"]] = row["N"] - mysql_execute("update datas set data = {} where `key` = 'from_type'".format( json.dumps(data) )) + mysql_execute("update datas set data = '{}' where `key` = 'from_type'".format( json.dumps(data) )) if __name__ == "__main__":