pyspark之Structured Streaming结果保存到Mysql数据库-socket例子统计(含批次)
frompyspark.sqlimportSparkSession,DataFramefrompyspark.sql.functionsimportexplode,split,lit"""实现将数据保存到mysql数据库,同时将流计算batch保存到数据库中"""if__name__=='__main__':spark=SparkSession.builder.getOrCreate()spark