-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathgenerate-data.py
27 lines (22 loc) · 877 Bytes
/
generate-data.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
import random
import string
departments = [
"Accounting",
"Research",
"Sales",
"Operations",
"Marketing",
"Human Resources",
]
def create_snowflake_inserts_file(n: int) -> None:
"""Create a file with n snowflake inserts"""
with open("snowflake-inserts.sql", "w") as f:
f.write("-- this script generated by generate-data.py \n")
f.write("insert into whylogs_demo.public.demo_table(id, name, age, department) values \n")
for i in range(n):
random_department = random.choice(departments)
random_characters = "".join(random.choices(string.ascii_letters, k=10))
random_age = random.randint(0, 80)
f.write(f"({i}, '{random_characters}', {random_age}, '{random_department}') {',' if i < n-1 else ';'} \n")
if __name__ == "__main__":
create_snowflake_inserts_file(10_000)