gen-database: add age to user table to test agg

Signed-off-by: Pere Diaz Bou <pere-altea@hotmail.com>
This commit is contained in:
Pere Diaz Bou
2024-06-30 09:15:17 +02:00
parent 123f6353f7
commit 1419ae93bc

View File

@@ -2,6 +2,7 @@
import sqlite3
from faker import Faker
import random
conn = sqlite3.connect('database.db')
cursor = conn.cursor()
@@ -17,7 +18,8 @@ cursor.execute('''
address TEXT,
city TEXT,
state TEXT,
zipcode TEXT
zipcode TEXT,
age INTEGER
)
''')
@@ -31,11 +33,14 @@ for _ in range(10000):
city = fake.city()
state = fake.state_abbr()
zipcode = fake.zipcode()
age = random.randint(0, 100) % 99
cursor.execute('''
INSERT INTO users (first_name, last_name, email, phone_number, address, city, state, zipcode)
VALUES (?, ?, ?, ?, ?, ?, ?, ?)
''', (first_name, last_name, email, phone_number, address, city, state, zipcode))
INSERT INTO users (first_name, last_name, email, phone_number, address, city, state, zipcode, age)
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)
''', (first_name, last_name, email, phone_number, address, city, state, zipcode, age))
conn.commit()
conn.close()