sql python
2020.07.01 07:51
def setmd5_net(img_path,md5value):
return ""
def getdxid_net(dx_):
sql = "SELECT id FROM diagnosis WHERE dx = %s;" % (db.escape(dx_))
#print(sql)
try:
cursor = db.cursor()
cursor.execute(sql)
results = cursor.fetchall()
if len(results)==0:return -1
return int(results[0][0])
except Exception as e:
print (e)
print ("Error: unable to fetch data : getdxlist_net")
f_sqllog.write(e+'\n')
f_sqllog.write(sql+'\n')
sys.exit(1)
return -1
def setdxid_net(dx_,dx_full="",dx_alias=json.dumps([])):
if dx_full=="":dx_full=dx_
sql="INSERT INTO diagnosis(dx,fulldx,alias) VALUES (%s,%s,%s);" % (db.escape(dx_),db.escape(dx_full),db.escape(dx_alias))
print(sql)
try:
cursor = db.cursor()
cursor.execute(sql)
db.commit()
except Exception as e:
print (e)
print ("Error: unable to fetch data : setdxlist_net")
f_sqllog.write(e+'\n')
f_sqllog.write(sql+'\n')
sys.exit(1)
return True
def updatedxid_net(dx_,dx_full,dx_alias):
sql="UPDATE diagnosis SET fulldx=%s,alias=%s WHERE dx=%s;" % (db.escape(dx_full),db.escape(dx_alias),db.escape(dx_))
try:
cursor = db.cursor()
cursor.execute(sql)
db.commit()
except Exception as e:
print (e)
print ("Error: unable to fetch data : updatedxlist_net")
f_sqllog.write(e+'\n')
f_sqllog.write(sql+'\n')
sys.exit(1)
return True
def setdxlist_net(list_dx):
for dx_ in list_dx:
if getdxid_net(dx_)==-1:
print("Not Found, and Create",dx_)
setdxid_net(dx_)
list_dx_net={}
for i,dx_ in enumerate(list_dx):
list_dx_net[i]=getdxid_net(dx_)
return list_dx_net
def getid_engine_net(engine):
sql = "SELECT id FROM engine WHERE name = %s;" % (db.escape(engine))
#print(sql)
try:
cursor = db.cursor()
cursor.execute(sql)
results = cursor.fetchall()
if len(results)==0:
return -1
else:
return int(results[0][0])
except Exception as e:
print (e)
print ("Error: unable to fetch data : setengine_net")
f_sqllog.write(e+'\n')
f_sqllog.write(sql+'\n')
sys.exit(1)
return -1
def setengine_net(engine,list_dx):
engine_id=getid_engine_net(engine)
if engine_id!=-1:return engine_id
list_dx_json=json.dumps(list_dx)
sql="INSERT INTO engine(name,list_dx) VALUES (%s,%s);" % (db.escape(engine),db.escape(list_dx_json))
#print(sql)
try:
cursor = db.cursor()
cursor.execute(sql)
db.commit()
except Exception as e:
print (e)
print ("Error: unable to fetch data : setengine_net")
f_sqllog.write(e+'\n')
f_sqllog.write(sql+'\n')
sys.exit(1)
return getid_engine_net(engine)
def getmd5_net(img_path):
sql = "SELECT md5value FROM file WHERE img_path = %s;" % (db.escape(img_path))
#print(sql)
try:
cursor = db.cursor()
cursor.execute(sql)
results = cursor.fetchall()
return results[0][0]
except Exception as e:
print (e)
print ("Error: unable to fetch data : getmd5_net")
f_sqllog.write(e+'\n')
f_sqllog.write(sql+'\n')
return ""
def get_rcnn_net_from_md5(md5value,threshold_fine=0.1):
if md5value=="":return []
result_list=[]
sql = "SELECT `md5unique`,`fine1`,`fine2`,`fine3`,`fine4`,`id` FROM `cropinfo` WHERE md5unique LIKE %s AND fine1 > %f ORDER BY fine1 DESC;" % (db.escape(md5value+'%'),threshold_fine)
#print(sql)
try:
cursor = db.cursor()
cursor.execute(sql)
results = cursor.fetchall()
except Exception as e:
print (e)
print ("Error: unable to fetch data : get_rcnn_net_from_md5")
print(sql)
f_sqllog.write(e+'\n')
f_sqllog.write(sql+'\n')
for row in results:
result_list+=[[list(map(int,row[0].replace(md5value+'_','').split('_')))]+ [[row[1],row[2],row[3],row[4]],row[5]]] #row[5]=id
return result_list
댓글 0
번호 | 제목 | 글쓴이 | 날짜 | 조회 수 |
---|---|---|---|---|
1549 | 아래 주소는 새 홈페이지 주소입니다. | 한승석 | 2002.06.19 | 2122 |
1548 | 여기는 집입니다~ | 한승석 | 2003.01.10 | 2102 |
1547 | 승석이가 피부과에 합격했답니다. | 한승석 | 2003.01.10 | 2318 |
1546 | 외로움 | 한승석 | 2003.01.27 | 2107 |
1545 | 홈페이지 배경음악을 넣었습니다. | 한승석 | 2003.01.27 | 2108 |
1544 | 오늘은 인턴 페어웰을 암센터에서~~ | 한승석 | 2003.01.29 | 2107 |
1543 | 멋진 걸! | 채영광 | 2003.01.29 | 2107 |
1542 | 자료실에 성소재림 , catch me if you can 등의 영화가 올렸습니다. | 한승석 | 2003.01.29 | 2094 |
1541 | 다시 제주도로.. | 한승석 | 2003.01.30 | 2117 |
1540 | 요즘 얼굴에 주름이 생겨서 고민.. | 한승석 | 2003.01.30 | 2095 |
1539 | 도전과 응전 | 한승석 | 2003.01.30 | 2025 |
1538 | 홈페이지 새단장 완료 | 한승석 | 2003.01.30 | 2094 |
1537 | 한라병원에 도착했습니다... | 한승석 | 2003.01.31 | 2092 |
1536 | 한라 병원 인근의 겜방 ^^ | 한승석 | 2003.01.31 | 2114 |
1535 | 이번 달은 한라병원 응급실에 근무 | 한승석 | 2003.01.31 | 2844 |