def getDataAll(): rs = None try: sql = "select * from gonggaobody order BY insertTime;" rs = dbmysql.fetchall(sql) except Exception as e: util.logger.error(e) return rs
def select_fujian(**kwargs): rs = None try: sql = f"SELECT * FROM `ceshi`.`tbl_fj` WHERE `zt` = '0' ORDER BY `uid`;" rs = dbmysql.fetchall(sql) return rs except Exception as e: util.logger.error(e) return rs
def select_qyzz(**kwargs): rs = None try: sql = f"select zzmc from tbl_qy_zz where qyid='{kwargs['qyid']}' and zzmc ='{kwargs['zzmc']}';" rs = dbmysql.fetchall(sql) return rs except Exception as e: util.logger.error(e) return rs
def select_xinwen(**kwargs): rs = None try: sql = "select * from xinwen_baseinfo where title='%s';" % (kwargs["title"]) rs = dbmysql.fetchall(sql) return rs except Exception as e: util.logger.error(e) return rs
def qiyexx_list(**kwargs): rs = None try: # sql="select * from q_psname where zt <> 0 order by id limit 5,10;" sql = "select * from q_name_list where bh='%s' and qy_zt='1' order by inserttime desc limit 1;" % ( kwargs['bh']) rs = dbmysql.fetchall(sql) except Exception as e: util.logger.error(e) return rs
def qiyexx_url(**kwargs): rs = None try: # sql="SELECT * FROM tbl_query_temp WHERE cx_state='1' LIMIT 1;" sql = "select * from tbl_fupa_temp where cx_state='1' and type='0' and bh='%s' order by inserttime desc LIMIT 1;" % ( kwargs['bh']) # print(sql) rs = dbmysql.fetchall(sql) except Exception as e: util.logger.error(e) return rs
def read_mysql_to_csv(filename): with codecs.open(filename=filename, mode='w', encoding='utf-8') as f: write = csv.writer(f) sql = 'select * from feixiaohao' results = dbmysql.fetchall(sql=sql) a = ('id', 'fullname', 'price') write.writerow(a) c = 0 for result in results: b = (result[0], result[1], result[2]) c += 1 print(b) write.writerow(b) print(c)