- Clone this repo.
- Navigate to the root folder and in it, create the
in.txtfile. - Fill in the
in.txtfile. One line represents one table.
Example:TableName1 column_name1 colum_name2
TableName2
TableName3 column_name1 TableName1_id column_name2 - Run
main.py.
The main.py script will create sorted-in.txt, create-db.sql and log.txt file in the root folder.
Navigate to the create-db.sql file to view the newly generated SQL.
Additionally, you can now check the sorted-in.txt file. It contains the sorted contents of the in.txt file.
argument1 argument2 argument3 ... argumentN
Table1Name column1_name ForeignTableName_id column2_name
"Table1Name"is atable name argument. Every line must start with one and contain only one. These arguments must be capitalized and can contain small and capital letters, as well as digits."column1_name"and"column2_name"arecolumn arguments. They can contain small letters, digits and'_'symbols. They represent the column name of the table, and will be assigned an INTEGER data type in the table."ForeignTableName_id"is aforeign key argument. These arguments must end with an"_id"suffix. They must be capitalized and can contain small and capital letters, as well as digits, same as fortable name argument. The part before the"_id"should reference a table name. After the SQL is generated, the table (Table1Name) will have a foreign keyforeigntablename_idpointing to a columnforeigntablename_idof theForeignTableNametable.
Note before using:
- If
table name argumentisn't capitalized, the script will do it automatically. Also, it will remove any'_'characters from it as well.- If
column argumentcontains any capital letters, running the script will replace them with their lower case counterparts.- Part of the
foreign key argumentbefore the"_id"will be treated as if it was atable name argument(Explained above).These changes will be present in both the
create-db.sqlfile and thesorted-in.txtfile.
Check thelog.txtfile for the verbose explanations on these and other user mistakes, and for the script failures.