utils/port_data.py
def port_micro():
    """Function meant to port all micro data to the new database"""
    lb = load_workbook('micro.xlsx')

    ws = lb.active
    sheet_range = lb['Sheet1']

    letters = ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L']
    obj = []

    lettercount = 0
    count = 1

    connection = sqlite3.connect('data.db')
    cursor = connection.cursor()

    while True:
        if sheet_range[f'{letters[lettercount]}{count}'].value is not None:
            while True:
                if lettercount <= 11:
                    if sheet_range[f'{letters[lettercount]}{count}'].value is not None:
                        obj.append(str(sheet_range[f'{letters[lettercount]}{count}'].value))
                    else:
                        obj.append('')
                    lettercount += 1
                else:
                    lettercount = 0
                    count += 1
                    rtos = lt_check(obj[5], obj[7])
                    stoc = lt_check(obj[7], obj[10])
                    query = 'INSERT INTO mag_table(date_created, employee, item, serial_num, ins_type, rec_date, ' \
                            'start_date, accessories, appearance, functions, cleaning, complete, notes) ' \
                            'VALUES(?,?,?,?,?,?,?,?,?,?,?,?,?)'
                    cursor.execute(query,
                                   (obj[0], obj[1], obj[2], obj[3], obj[4], obj[5], obj[6], obj[7], obj[8], obj[9],
                                    obj[10], rtos, stoc))
                    connection.commit()
                    obj = []
                    break

        else:
            break
Function meant to port all micro data to the new database
Function meant to port all micro data to the new database
Function meant to port all micro data to the new database
def port_micro():
    lb = load_workbook('micro.xlsx')
    ws = lb.active
    sheet_range = lb['Sheet1']
    letters = ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L']
    obj = []
    lettercount = 0
    count = 1
    connection = sqlite3.connect('data.db')
    cursor = connection.cursor()
    while True:
        if sheet_range[f'{letters[lettercount]}{count}'].value is not None:
            while True:
                if lettercount <= 11:
                    if sheet_range[f'{letters[lettercount]}{count}'].value is not None:
                        obj.append(str(sheet_range[f'{letters[lettercount]}{count}'].value))
                    else:
                        obj.append('')
                    lettercount += 1
                else:
                    lettercount = 0
                    count += 1
                    rtos = lt_check(obj[5], obj[7])
                    stoc = lt_check(obj[7], obj[10])
                    query = 'INSERT INTO mag_table(date_created, employee, item, serial_num, ins_type, rec_date, ' \
                            'start_date, accessories, appearance, functions, cleaning, complete, notes) ' \
                            'VALUES(?,?,?,?,?,?,?,?,?,?,?,?,?)'
                    cursor.execute(query,
                                   (obj[0], obj[1], obj[2], obj[3], obj[4], obj[5], obj[6], obj[7], obj[8], obj[9],
                                    obj[10], rtos, stoc))
                    connection.commit()
                    obj = []
                    break
        else:
            break
def port_micro ( ) : lb = load_workbook ( 'micro.xlsx' ) ws = lb . active sheet_range = lb [ 'Sheet1' ] letters = [ 'A' , 'B' , 'C' , 'D' , 'E' , 'F' , 'G' , 'H' , 'I' , 'J' , 'K' , 'L' ] obj = [ ] lettercount = 0 count = 1 connection = sqlite3 . connect ( 'data.db' ) cursor = connection . cursor ( ) while True : if sheet_range [ f'{letters[lettercount]}{count}' ] . value is not None : while True : if lettercount <= 11 : if sheet_range [ f'{letters[lettercount]}{count}' ] . value is not None : obj . append ( str ( sheet_range [ f'{letters[lettercount]}{count}' ] . value ) ) else : obj . append ( '' ) lettercount += 1 else : lettercount = 0 count += 1 rtos = lt_check ( obj [ 5 ] , obj [ 7 ] ) stoc = lt_check ( obj [ 7 ] , obj [ 10 ] ) query = 'INSERT INTO mag_table(date_created, employee, item, serial_num, ins_type, rec_date, ' 'start_date, accessories, appearance, functions, cleaning, complete, notes) ' 'VALUES(?,?,?,?,?,?,?,?,?,?,?,?,?)' cursor . execute ( query , ( obj [ 0 ] , obj [ 1 ] , obj [ 2 ] , obj [ 3 ] , obj [ 4 ] , obj [ 5 ] , obj [ 6 ] , obj [ 7 ] , obj [ 8 ] , obj [ 9 ] , obj [ 10 ] , rtos , stoc ) ) connection . commit ( ) obj = [ ] break else : break
Function meant to port all micro data to the new database
Function meant to port all micro data to the new database
"""Function meant to port all micro data to the new database"""