I am new at python and need help in comparing two TXT files and outputting their difference. Here is the scenario:
These text files contains the structure of a database table. We usually update the database and make structural changes to it, so basically we will have a pair of TXT files -- (for example) an Employee.txt file (before the DB upgrade in a folder like C:\before_upgrade) and a Employee.txt file (after the upgrade in a folder like C:\after_upgrade) containing the structure of the Employee Table. Employee.txt will contain the Column_Name, DataType, IsNullable, ColumnLength values like:
Emp_Id, bigint, No, null
Emp_F_Name, varchar, Yes, 100
Emp_L_Name, varchar, Yes, 200
IsActive, smallint, No, null
Now, I need to compare these TXT files and basically output the difference in such a way that it more more understandable to the user. Like if for a column, the IsNullable changes from Yes to No, then we output something like
"for Column_name: Emp_L_Name the IsNullable field changed to NO"
OR if a new column is added
"New column XYZ got added"
OR if a column is dropped
"Column IsActive got dropped" etc.
There are several tables in the DB so we need to compare more than one text file pairs. The table names will be read from another text file (like table_names.txt).
Thanks in advance.