コード例 #1
0
def get_settings_by_type(settings_type):
    try:
        setting_path = (db_session.query(TblSettings.path_to).filter(
            TblSettings.type_path == settings_type).all())[0][0]
        return setting_path
    except IndexError:
        return ''
コード例 #2
0
def del_file(file_id):
    try:
        file_for_del = db_session.query(TblFilesForCopy).get(file_id)
        db_session.delete(file_for_del)
        db_session.commit()
    except UnmappedInstanceError:
        print('Объект удален ранее')
コード例 #3
0
def delete_host(host_id):
    try:
        host_for_del = db_session.query(TblHosts).get(host_id)
        db_session.delete(host_for_del)
        db_session.commit()
    except UnmappedInstanceError:
        print('Объект удален ранее')
コード例 #4
0
def get_all_ch_file():
    raw_data = db_session.query(TblFilesForCopy.files_nam).filter(
        TblFilesForCopy.status_copy == True).all()
    data = []
    for file in raw_data:
        data.append(file[0])
    return data
コード例 #5
0
def upd_settings_by_type(new_path, settings_type):
    old_setting_path = db_session.query(TblSettings).filter(
        TblSettings.type_path == settings_type).first()
    old_setting_path.path_to = new_path
    db_session.commit()
コード例 #6
0
def upd_host(host_id, name, host, comment):
    up_host = db_session.query(TblHosts).get(host_id)
    up_host.name = name
    up_host.host_name = host
    up_host.host_comment = comment
    db_session.commit()
コード例 #7
0
def get_host_link_by_id(host_id):
    return db_session.query(TblHosts.host_name).filter(TblHosts.id == host_id).first()
コード例 #8
0
def get_all_info_by_id(host_id):
   return db_session.query(TblHosts.id, TblHosts.name, TblHosts.host_name,  TblHosts.host_comment).filter(TblHosts.id == host_id).first()
コード例 #9
0
def get_all_hosts_name_and_comment_with_id():
    act_data = db_session.query(TblHosts.id, TblHosts.name, TblHosts.host_comment).all()
    return act_data
コード例 #10
0
def upd_status(file_id, new_status):
    up_file = db_session.query(TblFilesForCopy).get(file_id)
    up_file.status_copy = new_status
    db_session.commit()
コード例 #11
0
def get_all_files_with_id():
    return db_session.query(TblFilesForCopy.id, TblFilesForCopy.files_nam,
                            TblFilesForCopy.status_copy).all()