本文整理匯總了Python中custom.db.mysql.Custom_MySQL.query_by_sql方法的典型用法代碼示例。如果您正苦於以下問題:Python Custom_MySQL.query_by_sql方法的具體用法?Python Custom_MySQL.query_by_sql怎麽用?Python Custom_MySQL.query_by_sql使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類custom.db.mysql.Custom_MySQL
的用法示例。
在下文中一共展示了Custom_MySQL.query_by_sql方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: in
# 需要導入模塊: from custom.db.mysql import Custom_MySQL [as 別名]
# 或者: from custom.db.mysql.Custom_MySQL import query_by_sql [as 別名]
"where s.type='dm' and s.id in ({0}) and d.id={1}) a where if(a.log_namee=f.log_name," \
"FROM_UNIXTIME(UNIX_TIMESTAMP(date_add(f.log_date,INTERVAL 1 DAY)), '%Y%m%d')=a.log_date," \
"f.log_date=a.log_date) and f.game=a.gamee and f.platform=a.platformm and f.log_name=a.table_namee " \
"and f.status!=3".format(from_id, pid)
else:
sql = "select distinct a.* from dw2dm_log f,(select s.game gamee,s.platform platformm," \
"s.table_name table_namee,d.log_name log_namee,s.flag flagg, d.* from structure s,dw2dm_log d " \
"where s.type='dm' and s.id in ({0}) and d.id={1}) a where if(a.log_namee=f.log_name," \
"FROM_UNIXTIME(UNIX_TIMESTAMP(date_add(f.log_date,INTERVAL 1 DAY)), '%Y%m%d')=a.log_date," \
"f.log_date=a.log_date) and f.game=a.gamee and f.platform=a.platformm and f.log_name=a.table_namee " \
"and f.status!=3".format(from_id, pid)
else:
sql = ""
#result = mysql.query(sql)
result = mysql.query_by_sql(sql)
# 如果為空,則全部完成
if result['output'] is None or result['output'] == '':
# 查找該條任務
formal_sql = "select d.*,s.db_name,s.table_name from dw2dm_log d, structure s " \
"where d.id = %s and d.target_id = s.id" % pid
formal_result = ""
if grouped == 1 and priority == 1:
formal_result = mysql.get(formal_sql)
elif grouped == 1 and priority != 1:
# 查找組別為1且優先級小於該條任務優先級的其他dw2dm任務是否完成
gpsql = "select d.* from dw2dm_log d,(select priority from dw2dm_log where id = %s) a " \
"where d.log_date = '%s' and d.game = '%s' and d.platform = '%s' and d.grouped = 1 " \