def clone_data(data):
     mc = mysql_connect.cursor()
     query = "SELECT * FROM bot_user WHERE bot_user_id IN (%s) "
     ids = ", ".join(data)
     mc.execute(query % ids)
     result = mc.fetchall()
     return result
 def count_data():
     mc = mysql_connect.cursor()
     query = "SELECT * FROM task_value_group"
     mc.execute(query)
     mc.fetchall()
     count = mc.rowcount
     return count
 def count_data():
     mc = mysql_connect.cursor()
     query = "SELECT * FROM task_function_category"
     mc.execute(query)
     mc.fetchall()
     count = mc.rowcount
     return count
Пример #4
0
 def count_data():
     mc = mysql_connect.cursor()
     query = "SELECT * FROM bot_task_template"
     mc.execute(query)
     mc.fetchall()
     count = mc.rowcount
     return count
Пример #5
0
 def get_bottasktemplate(checkbox_id):
     mc = mysql_connect.cursor()
     query = "SELECT b.bot_task_template_name FROM bot_task AS a LEFT JOIN bot_task_template as b ON b.bot_task_template_id=a.bot_task_template_id WHERE a.bot_task_id = %s "
     # query = "SELECT bot_task_template_name FROM bot_task WHERE bot_task_id = %s "
     mc.execute(query,(checkbox_id) )
     result = mc.fetchone() 
     return result  
 def get_task_function(start, limit):
     mc = mysql_connect.cursor()
     # query = "SELECT * FROM bot_task_template_tf LIMIT %s,%s "
     query = "SELECT a.*, b.scene_name, c.scene_category_name, d.task_value_type_name FROM bot_task_template_tf as a LEFT JOIN scene as b ON b.scene_id = a.scene_id LEFT JOIN scene_category as c ON c.scene_category_id=a.scene_category_id LEFT JOIN task_value_type as d ON d.task_value_type_id=a.task_value_type_id ORDER BY a.bot_task_template_tf_id ASC LIMIT %s,%s "
     mc.execute(query, (start, limit))
     result = mc.fetchall()
     return result
 def count_clone_data(data):
     mc = mysql_connect.cursor()
     query = "SELECT * FROM task_value WHERE task_value_id IN (%s) "
     ids = ", ".join(data)
     mc.execute(query % ids)
     mc.fetchall()
     count = mc.rowcount
     return count
Пример #8
0
 def save_data(name, description, filename, filerow):
     mc = mysql_connect.cursor()
     query = "INSERT INTO bot_task_template_file (name, description, file_name, file_row) VALUES (%s,%s,%s,%s)"
     data = (name, description, filename, filerow)
     mc.execute(query, (data))
     mysql_connect.commit()
     result = mc.fetchall()
     return result
 def save_bot_task(name, checkId, sn):
     mc = mysql_connect.cursor()
     now = datetime.now()
     query = "INSERT INTO bot_task (bot_task_name, bot_task_template_id, SN, created_at ) VALUES (%s,%s,%s,%s)"
     data = (name, checkId, sn, now)
     mc.execute(query, (data))
     mysql_connect.commit()
     result = mc.fetchall()
     return result
 def save_data(name, sn_range, group_name, last_sn):
     mc = mysql_connect.cursor()
     now = datetime.now()
     query = "INSERT INTO bot_task_template (bot_task_template_name, sn_range, bot_user_group_name, cloned_create_bot_task_groups ,created_at ) VALUES (%s,%s,%s,%s,%s)"
     data = (name, sn_range, group_name, last_sn, now)
     mc.execute(query, (data))
     mysql_connect.commit()
     result = mc.fetchall()
     return result
 def save_data(name, description):
     mc = mysql_connect.cursor()
     now = datetime.now()
     query = "INSERT INTO bot_user_group (bot_user_group_name, created_at ) VALUES (%s,%s)"
     data = (name, now)
     mc.execute(query, (data))
     mysql_connect.commit()
     result = mc.fetchall()
     return result
Пример #12
0
 def update_data(c1, c2):
     mc = mysql_connect.cursor()
     query = "UPDATE bot_task SET run_count = %s WHERE bot_task_id = %s"
     data = (c1,c2)
     mc.execute(query,(data))
     mysql_connect.commit()
     result = mc.fetchall()
     print("Record Updated successfully ")
     return result        
Пример #13
0
 def save_data(kategori,name,description):
     mc = mysql_connect.cursor()
     now = datetime.now()
     query = "INSERT INTO scene (scene_category_id, scene_name, created_at ) VALUES (%s,%s,%s)"
     data = (kategori,name,now)
     mc.execute(query,(data) )
     mysql_connect.commit()
     result = mc.fetchall()
     return result        
Пример #14
0
 def update_log(log, task):
     mc = mysql_connect.cursor()
     now = datetime.now()
     query = "INSERT INTO log (log_description, bot_task_group_id, log_start_date_time, log_end_date_time, created_at ) VALUES (%s,%s,%s,%s,%s)"
     data = (log, task, now, now, now)
     mc.execute(query, (data))
     mysql_connect.commit()
     result = mc.fetchall()
     return result
Пример #15
0
 def import_data(file_path):
     mc = mysql_connect.cursor()
     csv_data = csv.reader(open(file_path))
     next(csv_data)
     now = datetime.now()
     for row in csv_data:
         mc.execute('INSERT INTO task_value(task_value_name, task_value_category ,created_at) VALUES (%s, %s, %s)' , (row[0],row[1],now)  )
     mysql_connect.commit()
     mc.close()
Пример #16
0
    def import_data(file_path):
        mc = mysql_connect.cursor()
        csv_data = csv.reader(open(file_path))
        next(csv_data)
        # today = date.today()
        now = datetime.now()

        for row in csv_data:
            mc.execute('INSERT INTO bot_user(bot_user_name,created_at) VALUES (%s, %s)', (row, now))
        mysql_connect.commit()
        mc.close()
Пример #17
0
 def search_data3(data3):
     mc = mysql_connect.cursor()
     query = "SELECT a.*, b.scene_category_name, c.scene_name, d.task_value_group_name, e.task_value_type_name FROM task_value as a \
     LEFT JOIN scene_category as b ON b.scene_category_id = a.scene_category_id \
     LEFT JOIN scene as c ON c.scene_id = a.scene_id \
     LEFT JOIN task_value_group as d ON d.task_value_group_id = a.task_value_group_id \
     LEFT JOIN task_value_type as e ON e.task_value_type_id = a.task_value_type_id \
     WHERE task_value_name = %s "
     mc.execute(query,(data3) )
     result = mc.fetchall()
     return result    
Пример #18
0
 def get_data(start,limit):
     mc = mysql_connect.cursor()
     query = "SELECT a.*, b.scene_category_name, c.scene_name, d.task_value_group_name, e.task_value_type_name FROM task_value as a \
     LEFT JOIN scene_category as b ON b.scene_category_id = a.scene_category_id \
     LEFT JOIN scene as c ON c.scene_id = a.scene_id \
     LEFT JOIN task_value_group as d ON d.task_value_group_id = a.task_value_group_id \
     LEFT JOIN task_value_type as e ON e.task_value_type_id = a.task_value_type_id \
     LIMIT %s,%s "
     mc.execute(query,(start,limit) )
     result = mc.fetchall()
     return result    
Пример #19
0
    def import_data(file_path):
        mc = mysql_connect.cursor()
        csv_data = csv.reader(open(file_path))
        next(csv_data)
        now = datetime.now()
        for row in csv_data:
            id2 = int(row[2])
            id4 = int(row[4])
            id6 = int(row[6])

            mc.execute(
                'INSERT INTO task_function(task_function_name, task_function_content , task_function_category_id , task_function_category, task_value_group_id ,task_value_group, created_at) VALUES (%s, %s, %s, %s, %s, %s, %s)',
                (row[0], row[1], id2, row[3], id4, row[5], id6, now))
        mysql_connect.commit()
        mc.close()
Пример #20
0
 def save_data(task_function_id, task_function_name, scene_category_id,
               scene_category, scene_id, scene, task_value_type_id,
               task_value_type_name, task_value_group_id,
               task_value_group_name, task_value_count, unique_value,
               comment):
     mc = mysql_connect.cursor()
     now = datetime.now()
     query = "INSERT INTO bot_task_template_tf (task_function_id, task_function, scene_category_id, scene_category, scene_id, scene, task_value_type_id, task_value_type, task_value_group_id, task_value_group, task_value_count, unique_task_value, comment, created_at) VALUES (%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s)"
     data = (task_function_id, task_function_name, scene_category_id,
             scene_category, scene_id, scene, task_value_type_id,
             task_value_type_name, task_value_group_id,
             task_value_group_name, task_value_count, unique_value, comment,
             now)
     mc.execute(query, (data))
     result = mc.fetchall()
     return result
Пример #21
0
 def delete_data(data):
     mc = mysql_connect.cursor()
     query = "SELECT * FROM bot_task_template WHERE bot_task_template_name = %s ORDER BY bot_task_template_id DESC"
     mc.execute(query, (data))
     result = mc.fetchall()
     return result
Пример #22
0
 def get_data(start, limit):
     mc = mysql_connect.cursor()
     query = "SELECT * FROM bot_task_template ORDER BY bot_task_template_id DESC LIMIT %s,%s "
     mc.execute(query, (start, limit))
     result = mc.fetchall()
     return result
Пример #23
0
 def retrieve_data():
     mc = mysql_connect.cursor()
     query = "SELECT * FROM bot_task_template ORDER BY bot_task_template_id DESC LIMIT 0,20 "
     mc.execute(query)
     result = mc.fetchall()
     return result
Пример #24
0
 def retrieve_data():
     mc = mysql_connect.cursor()
     query = "SELECT * FROM log LIMIT 0,20 ORDER BY log_id DESC"
     mc.execute(query)
     result = mc.fetchall()
     return result
Пример #25
0
 def search_data(data):
     mc = mysql_connect.cursor()
     query = "SELECT * FROM log WHERE log_description = %s ORDER BY log_id DESC"
     mc.execute(query, (data))
     result = mc.fetchall()
     return result
 def delete_data(data):
     mc = mysql_connect.cursor()
     query = "SELECT * FROM task_value_group WHERE task_value_group_name = %s ORDER BY task_value_group_id DESC"
     mc.execute(query, (data))
     result = mc.fetchall()
     return result
 def get_data(start, limit):
     mc = mysql_connect.cursor()
     query = "SELECT * FROM task_value_group ORDER BY task_value_group_id DESC LIMIT %s,%s "
     mc.execute(query, (start, limit))
     result = mc.fetchall()
     return result
 def retrieve_data():
     mc = mysql_connect.cursor()
     query = "SELECT * FROM task_value_group ORDER BY task_value_group_id DESC LIMIT 0,20 "
     mc.execute(query)
     result = mc.fetchall()
     return result
Пример #29
0
 def retrieve_data():
     mc = mysql_connect.cursor()
     query = "SELECT * FROM bot_user LIMIT 0,20 "
     mc.execute(query)
     result = mc.fetchall()
     return result
Пример #30
0
 def search_data3(data):
     mc = mysql_connect.cursor()
     query = "SELECT * FROM bot_user WHERE last_name = %s "
     mc.execute(query, (data))
     result = mc.fetchall()
     return result