|
@@ -224,21 +224,18 @@ class MigrationCleaning:
|
|
|
db = self._sql_db
|
|
|
|
|
|
if invalid_mask.sum() == 0:
|
|
|
-
|
|
|
return data
|
|
|
- print('INCOMING DATA', data)
|
|
|
- print('INCOMING DATA COLUMNS', data.columns)
|
|
|
- print('THIS IS THE INVALID MASK:', invalid_mask)
|
|
|
+
|
|
|
data_inconsist = data.assign(reason=reason)\
|
|
|
.loc[invalid_mask]\
|
|
|
.reset_index(drop=True)
|
|
|
|
|
|
if db.check_if_table_exists(self._inconsist_report_table):
|
|
|
columns = db.get_column_names(tablename=self._inconsist_report_table)
|
|
|
- print(('COLUMNS: {}, FROM {} TABLE').format(columns, self._inconsist_report_table))
|
|
|
|
|
|
if len(columns) > 0:
|
|
|
- print('ICONSIST DATA COLUMNS:', data_inconsist.columns)
|
|
|
+ columns_not_in_data = [column for column in colunmns if column not in data.columns]
|
|
|
+ data_inconsist[columns_not_in_data] = 'Column does not exist in the mongo database and has therefore been dropped'
|
|
|
data_inconsist = data_inconsist[columns]
|
|
|
|
|
|
db.append_to_table(data=data_inconsist,
|