def __noIntent_selectAll__(self): conn, cursor = DB().DBconnect() command = """ select Question from CBT_NoIntent_VIW """ try: cursor.execute(command) for row in cursor: print(row) except Exception as e: print("Error ", e) DB().DBdisconnect()
def ShowSlots(self): conn, cursor = DB().DBconnect() command = """ Select * From CBT_LKP_Slot """ try: cursor.execute(command) for row in cursor: print(row) except Exception as e: print("Error ", e) DB().DBdisconnect()
def __noIntent_delete__(self, _id): conn, cursor = DB().DBconnect() command = """ EXEC CBT_NoIntent_DEL @ID=? """ arg = _id try: cursor.execute(command, arg) print("Deleted Successfully") conn.commit() except Exception as e: print("Error ", e) DB().DBdisconnect()
def __noIntent_update__(self, _id, Q): conn, cursor = DB().DBconnect() command = """ EXEC CBT_NoIntent_UPD @ID=?, @Question=? """ arg = (_id, Q) try: cursor.execute(command, arg) print("Updated Successfully") conn.commit() except Exception as e: print("Error ", e) DB().DBdisconnect()
def __noIntent_insert__(self, Q): conn, cursor = DB().DBconnect() command = """ EXEC CBT_NoIntent_INS @Question=? """ arg = Q try: cursor.execute(command, arg) print("Inserted Successfully") conn.commit() except Exception as e: print("Error ", e) DB().DBdisconnect()
def __lowProb_insert__(self, Q, IntentID): conn, cursor = DB().DBconnect() command = """ EXEC CBT_LowProb_INS @Question=?, @IntentID=? """ arg = (Q, IntentID) try: cursor.execute(command, arg) print("Inserted Successfully") conn.commit() except Exception as e: print("Error ", e) DB().DBdisconnect()
def __lowProb_selectIntent__(self, ID): conn, cursor = DB().DBconnect() command = """ select * from CBT_LowProb_VIW where IntentID= %d """ % ID try: cursor.execute(command) for row in cursor: print(row) except Exception as e: print("Error ", e) DB().DBdisconnect()
def __feedback_update__(self, _id, Log_ID, Rate, Message): conn, cursor = DB().DBconnect() command = """ EXEC CBT_Feedback_UPD @id=?, @logid=? , @rate=? , @text=? """ arg = (_id, Log_ID, Rate, Message) try: cursor.execute(command, arg) print("updated Successfully") conn.commit() except Exception as e: print("Error ", e) DB().DBdisconnect()
def SaveIntent(self, name): conn, cursor = DB().DBconnect() command = """ EXEC CBT_LKP_Intent_INS @Name=? """ arg = name try: cursor.execute(command, arg) print("Inserted Successfully") conn.commit() except Exception as e: print("Error ", e) DB().DBdisconnect()
def SaveIntentSlot(self, intentID, slotID): conn, cursor = DB().DBconnect() command = """ EXEC CBT_LNK_IntentSlot_INS @IntentID=? , @SlotID=? """ arg = (intentID, slotID) try: cursor.execute(command, arg) print("Inserted Successfully") conn.commit() except Exception as e: print("Error ", e) DB().DBdisconnect()
def GetSlot(self, name): conn, cursor = DB().DBconnect() command = """ Select ID From CBT_LKP_Slot Where Name = '{0}' """.format(name) try: tpl = [] cursor.execute(command) for row in cursor: tpl.append(row) except Exception as e: print("Error ", e) DB().DBdisconnect() return tpl
def GetIntentSlot(self, IntentName): conn, cursor = DB().DBconnect() command = """ Select Slot From CBT_LNK_IntentSlot_VIW Where Intent = '{0}' """.format(IntentName) try: tpl = [] cursor.execute(command) for row in cursor: tpl.append(row) except Exception as e: print("Error ", e) DB().DBdisconnect() return tpl
def UpdateIntent(self, id, name): conn, cursor = DB().DBconnect() command = """ EXEC CBT_LKP_Intent_UPD @ID=? ,@Name=? """ arg = (id, name) try: cursor.execute(command, arg) print("Updated Successfully") conn.commit() except Exception as e: print("Error ", e) DB().DBdisconnect()
def DeleteIntentSlot(self, id): conn, cursor = DB().DBconnect() command = """ EXEC CBT_LNK_IntentSlot_DEL @ID=? """ arg = id try: cursor.execute(command, arg) print("Deleted Successfully") conn.commit() except Exception as e: print("Error ", e) DB().DBdisconnect()