#!/home/ajv/work/venv312/bin/python

# cPy - monitoring table data from sqlite database test.db
# provided by Anthony Vogelaar, Perth Scotland
# rev 0.10  2024-08-07 initial release

import  os;     os.system('clear')
import  time
import  sqlite3

def main():
    with sqlite3.connect('test.db') as conn:
        n    = 0
        cur  = conn.cursor()
        while True:
            n += 1
            cur.execute('SELECT * FROM data')
            data = cur.fetchall()
            os.system('clear')
            print(n)
            for row in data:
                print(f'{row[0]:<5} {row[1]:5} {row[2]:5}')
            time.sleep(1)

main()

# ================================ End ==================================
