from my_functions import open_basiccrud_db
from my_functions import close_database
from prettytable import PrettyTable

conn, cursor = open_basiccrud_db()
sql = '''
    SELECT * FROM users 
'''
cursor.execute(sql)
data = cursor.fetchall()
table = PrettyTable(
    ['name', 'age', 'dateofbirth', 'sex', 'email']
)
for (name, age, dob, sex, email) in data:
    table.add_row([name, age, dob, sex, email])
print(table)
close_database(cursor, conn)