Commit e4a4dc41 authored by lixiaofang's avatar lixiaofang

try except

parent a777fa69
This diff is collapsed.
......@@ -180,7 +180,7 @@ def get_topic_id(numtime):
db = pymysql.connect(host="rm-2ze5k2we69904787l.mysql.rds.aliyuncs.com", user='work', passwd='Gengmei123',
db="alpha", port=3306)
cursor = db.cursor()
cursor.execute("SELECT id FROM topic WHERE create_time >= %s" ,(numtime))
cursor.execute("SELECT id FROM topic WHERE is_online =1 and create_time >= %s" ,(numtime))
data = cursor.fetchall()
user_id = list(data)
logging.info("Database version : %s " % user_id)
......
......@@ -114,7 +114,7 @@ def get_data(numtime):
db = pymysql.connect(host="rm-2ze5k2we69904787l.mysql.rds.aliyuncs.com", user='work', passwd='Gengmei123',
db="alpha", port=3306)
cursor = db.cursor()
cursor.execute("SELECT user_id,id FROM topic WHERE create_time LIKE '%%%%%s%%%%'" % numtime)
cursor.execute("SELECT user_id,id FROM topic WHERE is_online=1 and create_time LIKE '%%%%%s%%%%'" % numtime)
data = cursor.fetchall()
user_id = list(data)
logging.info("Database version : %s " % user_id)
......
......@@ -110,7 +110,7 @@ def get_data(numtime):
db="alpha", port=3306)
cursor = db.cursor()
print("---------")
cursor.execute("SELECT user_id,id FROM topic WHERE create_time LIKE '%%%%%s%%%%'" % numtime)
cursor.execute("SELECT user_id,id FROM topic WHERE is_online=1 and create_time LIKE '%%%%%s%%%%'" % numtime)
data = cursor.fetchall()
user_id = list(data)
logging.info("Database version : %s " % user_id)
......
......@@ -110,7 +110,7 @@ def get_data(numtime):
db = pymysql.connect(host="rm-2ze5k2we69904787l.mysql.rds.aliyuncs.com", user='work', passwd='Gengmei123',
db="alpha", port=3306)
cursor = db.cursor()
cursor.execute("SELECT user_id,id FROM topic WHERE create_time LIKE '%%%%%s%%%%'" % numtime)
cursor.execute("SELECT user_id,id FROM topic WHERE is_online=1 and create_time LIKE '%%%%%s%%%%'" % numtime)
data = cursor.fetchall()
user_id = list(data)
logging.info("Database version : %s " % user_id)
......
......@@ -115,7 +115,7 @@ def get_topic_id(numtime):
try:
db = pymysql.connect(host="rm-2ze5k2we69904787l.mysql.rds.aliyuncs.com", user='work', passwd='Gengmei123', db="alpha", port=3306)
cursor = db.cursor()
cursor.execute("SELECT id FROM topic WHERE create_time LIKE '%%%%%s%%%%' " %numtime)
cursor.execute("SELECT id FROM topic WHERE is_online=1 and create_time LIKE '%%%%%s%%%%' " %numtime)
data = cursor.fetchall()
topic_id = list(data)
logging.info("Database version : %s "%topic_id)
......
......@@ -132,7 +132,7 @@ def get_topic_new_user(numtime):
db = pymysql.connect(host="rm-2ze5k2we69904787l.mysql.rds.aliyuncs.com", user='work', passwd='Gengmei123',
db="alpha", port=3306)
cursor = db.cursor()
cursor.execute("SELECT user_id FROM topic WHERE create_time LIKE '%%%%%s%%%%'" % numtime)
cursor.execute("SELECT user_id FROM topic WHERE is_online=1 and create_time LIKE '%%%%%s%%%%'" % numtime)
topic_data = cursor.fetchall()
cursor.execute("SELECT user_id FROM group_user_role WHERE create_time LIKE '%%%%%s%%%%'" % numtime)
......@@ -157,7 +157,7 @@ def get_topic_data(numtime):
db = pymysql.connect(host="rm-2ze5k2we69904787l.mysql.rds.aliyuncs.com", user='work', passwd='Gengmei123',
db="alpha", port=3306)
cursor = db.cursor()
cursor.execute("SELECT user_id,id FROM topic WHERE create_time LIKE '%%%%%s%%%%'" % numtime)
cursor.execute("SELECT user_id,id FROM topic WHERE is_online=1 and create_time LIKE '%%%%%s%%%%'" % numtime)
data = cursor.fetchall()
user_id = list(data)
logging.info("Database version : %s " % user_id)
......
......@@ -110,7 +110,7 @@ def get_data(numtime):
db = pymysql.connect(host="rm-2ze5k2we69904787l.mysql.rds.aliyuncs.com", user='work', passwd='Gengmei123',
db="alpha", port=3306)
cursor = db.cursor()
cursor.execute("SELECT distinct(user_id) FROM topic WHERE create_time LIKE '%%%%%s%%%%'" % numtime)
cursor.execute("SELECT distinct(user_id) FROM topic WHERE is_online=1 and create_time LIKE '%%%%%s%%%%'" % numtime)
data = cursor.fetchall()
user_id = list(data)
logging.info("Database version : %s " % user_id)
......@@ -137,7 +137,7 @@ def get_commnet_id(numtime):
data_reply = cursor.fetchall()
cursor.execute(
"SELECT user_id FROM group_follow WHERE create_time LIKE '%%%%%s%%%%'" % numtime)
"SELECT user_id FROM group_user_role WHERE create_time LIKE '%%%%%s%%%%'" % numtime)
data_group_follow = cursor.fetchall()
......
......@@ -131,7 +131,7 @@ def get_data(numtime):
db = pymysql.connect(host="rm-2ze5k2we69904787l.mysql.rds.aliyuncs.com", user='work', passwd='Gengmei123',
db="alpha", port=3306)
cursor = db.cursor()
cursor.execute("SELECT user_id,id FROM topic WHERE create_time LIKE '%%%%%s%%%%'" % numtime)
cursor.execute("SELECT user_id,id FROM topic WHERE is_online=1 and create_time LIKE '%%%%%s%%%%'" % numtime)
data = cursor.fetchall()
user_id = list(data)
logging.info("Database version : %s " % data)
......
......@@ -143,7 +143,7 @@ def get_data(numtime):
try:
db = pymysql.connect(host="rm-2ze5k2we69904787l.mysql.rds.aliyuncs.com", user='work', passwd='Gengmei123', db="alpha", port=3306)
cursor = db.cursor()
cursor.execute("SELECT distinct(user_id) FROM topic WHERE create_time LIKE '%%%%%s%%%%'" %numtime)
cursor.execute("SELECT distinct(user_id) FROM topic WHERE create_time LIKE '%%%%%s%%%%'" %numtime)
data = cursor.fetchall()
user_id = list(data)
logging.info("Database version : %s " % data)
......
......@@ -134,7 +134,7 @@ def get_star_user_id(numtime):
db="alpha", port=3306)
cursor = db.cursor()
cursor.execute(
"SELECT user_id FROM topic WHERE content_level =4 or content_level =5 and create_time LIKE '%%%%%s%%%%'" % numtime)
"SELECT user_id FROM topic WHERE content_level =4 or content_level =5 and create_time LIKE '%%%%%s%%%%'" % numtime)
data = cursor.fetchall()
user_id = list(data)
logging.info("Database version : %s " % data)
......@@ -150,7 +150,7 @@ def get_star_topic_id(numtime):
db="alpha", port=3306)
cursor = db.cursor()
cursor.execute(
"SELECT id FROM topic WHERE content_level =4 or content_level =5 and create_time LIKE '%%%%%s%%%%'" % numtime)
"SELECT id FROM topic WHERE is_online=1 and content_level =4 or content_level =5 and create_time LIKE '%%%%%s%%%%'" % numtime)
data = cursor.fetchall()
user_id = list(data)
logging.info("Database version : %s " % data)
......
......@@ -128,7 +128,7 @@ def get_star_useid(numtime):
db="alpha", port=3306)
cursor = db.cursor()
cursor.execute(
"SELECT user_id FROM topic WHERE content_level =4 or content_level =5 and create_time LIKE '%%%%%s%%%%'" % numtime)
"SELECT user_id FROM topic WHERE content_level =4 or content_level =5 and create_time LIKE '%%%%%s%%%%'" % numtime)
data = cursor.fetchall()
user_id = list(data)
logging.info("Database version : %s " % data)
......
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