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 ''
Exemple #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('Объект удален ранее')
Exemple #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('Объект удален ранее')
Exemple #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
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()
Exemple #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()
Exemple #7
0
def get_host_link_by_id(host_id):
    return db_session.query(TblHosts.host_name).filter(TblHosts.id == host_id).first()
Exemple #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()
Exemple #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
Exemple #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()
Exemple #11
0
def get_all_files_with_id():
    return db_session.query(TblFilesForCopy.id, TblFilesForCopy.files_nam,
                            TblFilesForCopy.status_copy).all()