29 lines
764 B
Python
29 lines
764 B
Python
# This is a sample Python script.
|
|
from sqlparse import SQLParser
|
|
from sqlgenerator import SQLGenerator
|
|
|
|
|
|
# Press Umschalt+F10 to execute it or replace it with your code.
|
|
# Press Double Shift to search everywhere for classes, files, tool windows, actions, and settings.
|
|
|
|
def main():
|
|
sql_tables = SQLParser.parse_sql_file("schema.sql")
|
|
inserts = []
|
|
for table in sql_tables:
|
|
for i in range(0, 100):
|
|
inserts.append(SQLGenerator.generate_random_insert(table))
|
|
|
|
with open("inserts.sql", "w") as file:
|
|
for insert in inserts:
|
|
file.write(insert + "\n")
|
|
|
|
|
|
|
|
|
|
|
|
# Press the green button in the gutter to run the script.
|
|
if __name__ == '__main__':
|
|
main()
|
|
|
|
# See PyCharm help at https://www.jetbrains.com/help/pycharm/
|