pym=mysql(host = '#', port = 3306, user = '#',passworld='#',database='#') #根据起始和结束时间
charge_sql = 'SELECT log_date, campaign_id, campaign_name,roi,FROM zuanshi.report_campaign_day
WHERE account_id={0} AND campaign_model=1 AND effect=15 AND effect_type="impression" ' \ 'and log_date BETWEEN "{1}" AND "{2}"'.format(accountId,start_date,end_date) #根据字符串 date_str="2018-01-01,2018-01-02,2018-01-03" str=data_str.split(',') li=list()
for s in str: if s.strip(" ") not in li: li.append(s.strip(" "))
charge_sql = 'SELECT log_date, campaign_id, campaign_name,roi,FROM zuanshi.report_campaign_day
WHERE account_id={0} AND campaign_model=1 AND effect=15 AND effect_type="impression" ' \ 'and log_date in{1}'.format(accountId,typle(li))
campaign_data = pym.Query(charge_sql)