Commit 4902e9e0 authored by 张彦钊's avatar 张彦钊

add multi file

parent 725a21a8
......@@ -5,13 +5,18 @@ from pyspark.conf import SparkConf
import pytispark.pytispark as pti
from pyspark.sql import SQLContext
from pyspark.sql import SparkSession
import datetime
def test():
spark = SparkSession.builder.enableHiveSupport().getOrCreate()
ti = pti.TiContext(spark)
ti.tidbMapDatabase("jerry_test")
spark.sql("select device_id from esmm_pre_data limit 6").show(6)
validate_date = spark.sql("select max(stat_date) from esmm_train_data").collect().map(lambda x:x(0))
print("validate_date:" + validate_date)
temp = datetime.datetime.strptime(validate_date, "%Y-%m-%d")
start = (temp - datetime.timedelta(days=10)).strftime("%Y-%m-%d")
print(start)
if __name__ == '__main__':
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment