-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcomparision.py
More file actions
489 lines (429 loc) · 31.1 KB
/
Copy pathcomparision.py
File metadata and controls
489 lines (429 loc) · 31.1 KB
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
from collections import defaultdict
import json
import os
import sys
def catalog_compare(input_arr, newly_added_fields, removed_fields, available_fields, automatic_fields, unsupported_fields, streams, added_uncommon_pairs, removed_uncommon_pairs, final_fields, final_fields_format, added_format, removed_format):
key = list(input_arr.keys())
folder_name = input_arr[key[0]]['folder_name']
path = input_arr[key[0]]['path']
tap_name = input_arr[key[0]]['tap_name']
all_fields = defaultdict(dict)
for keys in key:
for stream in streams[keys]:
all_fields[keys][stream] = list((set(available_fields[keys][stream]).union(set(automatic_fields[keys][stream]))).union(set(unsupported_fields[keys][stream])))
if '-' in all_fields[keys][stream]:
all_fields[keys][stream] = list(set(all_fields[keys][stream]) - set('-'))
diff_streams = []
diff_streams_1 = []
if streams[key[0]] == streams[key[1]]:
for stream in streams[key[1]]:
newly_added_fields[stream] = list(set(all_fields[key[0]][stream]) - set(all_fields[key[1]][stream]))
removed_fields[stream] = list(set(all_fields[key[1]][stream]) - set(all_fields[key[0]][stream]))
else:
diff_streams_1 = list(set(streams[key[0]]) - set(streams[key[1]]))
temp_streams_3 = list(set(streams[key[0]]) - set(diff_streams_1))
diff_streams = temp_streams_3
if len(diff_streams) != 0:
for stream in diff_streams:
newly_added_fields[stream] = list(set(all_fields[key[0]][stream]) - set(all_fields[key[1]][stream]))
removed_fields[stream] = list(set(all_fields[key[1]][stream]) - set(all_fields[key[0]][stream]))
if len(diff_streams_1) != 0:
for stream in diff_streams_1:
newly_added_fields[stream] = list(all_fields[key[0]][stream])
diff_streams_1 = []
diff_streams_1 = list(set(streams[key[1]]) - set(streams[key[0]]))
if len(diff_streams_1) != 0:
for stream in diff_streams_1:
removed_fields[stream] = list(all_fields[key[1]][stream])
def loader(branches, fields, stream, field2):
for field, data in fields.items():
if field2:
appending_field = field2 + '.' + field
else:
appending_field = field
if 'properties' in data:
if data['properties'] != {}:
final_fields[branches][stream][appending_field] = data['type']
loader(branches, data['properties'], stream, appending_field)
else:
final_fields[branches][stream][appending_field] = data['type']
if 'format' in data:
final_fields_format[branches][stream][appending_field] = data['format']
elif "items" in data and "properties" in data["items"]:
final_fields[branches][stream][appending_field] = data['type']
appending_field = appending_field+".items"
final_fields[branches][stream][appending_field] = data['items']['type']
loader(branches, data["items"]["properties"], stream, appending_field)
elif 'items' in data and "properties" not in data["items"]:
final_fields[branches][stream][appending_field] = data['type']
if data['items'] != {}:
appending_field = appending_field + '.items'
final_fields[branches][stream][appending_field] = data['items']['type']
if 'format' in data['items']:
final_fields_format[branches][stream][appending_field] = data['items']['format']
if data['items'] == {}:
appending_field = appending_field + '.items'
final_fields[branches][stream][appending_field] = list('{}')
if 'format' in data['items']:
final_fields_format[branches][stream][appending_field] = data['items']['format']
elif 'anyOf' in data:
final_fields[branches][stream][appending_field] = []
for x in range(len(data['anyOf'])):
final_fields[branches][stream][appending_field].append(data['anyOf'][x]['type'])
for x in range(len(data['anyOf'])):
if "items" in data['anyOf'][x] and "properties" in data['anyOf'][x]["items"]:
appending_field = appending_field+".items"
final_fields[branches][stream][appending_field] = data['anyOf'][x]['items']['type']
loader(branches, data['anyOf'][x]['items']['properties'], stream, appending_field)
elif 'properties' in data['anyOf'][x]:
if data['anyOf'][x]['properties'] != {}:
final_fields[branches][stream][appending_field] = data['anyOf'][x]['type']
loader(branches, data['anyOf'][x]['properties'], stream, appending_field)
else:
final_fields[branches][stream][appending_field] = data['anyOf'][x]['type']
if 'format' in data['anyOf'][x]:
final_fields_format[branches][stream][appending_field] = data['anyOf'][x]['format']
else:
if 'type' in data:
final_fields[branches][stream][appending_field] = data['type']
if 'format' in data:
final_fields_format[branches][stream][appending_field] = data['format']
else:
final_fields[branches][stream][appending_field] = data
for branches in input_arr:
folder_name = input_arr[branches]['folder_name']
path = input_arr[branches]['path']
tap_name = input_arr[branches]['tap_name']
with open(path+'/'+folder_name+'/tap-'+tap_name+'/catalog.json', 'r+') as f:
json_load = json.load(f)
data = json_load['streams']
for x in range(int(len(data))):
schema = data[x]['schema']['properties']
final_fields[branches][data[x]["stream"]] = {}
final_fields_format[branches][data[x]["stream"]] = {}
loader(branches, schema, data[x]["stream"], "")
f.close()
diff_streams = []
diff_streams_1 = []
def schema_compare(diff_streams):
for stream in diff_streams:
if stream in final_fields[key[0]]:
for field in final_fields[key[0]][stream]:
if (field in final_fields[key[1]][stream] and final_fields[key[0]][stream][field] == final_fields[key[1]][stream][field]):
pass
else:
added_uncommon_pairs[stream][field] = final_fields[key[0]][stream][field]
if stream in final_fields_format[key[0]]:
for field in final_fields_format[key[0]][stream]:
if (field in final_fields_format[key[1]][stream] and final_fields_format[key[0]][stream][field] == final_fields_format[key[1]][stream][field]):
pass
else:
added_format[stream][field] = final_fields_format[key[0]][stream][field]
if stream in final_fields[key[1]]:
for field in final_fields[key[1]][stream]:
if (field in final_fields[key[0]][stream] and final_fields[key[1]][stream][field] == final_fields[key[0]][stream][field]):
pass
else:
removed_uncommon_pairs[stream][field] = final_fields[key[1]][stream][field]
if stream in final_fields_format[key[1]]:
for field in final_fields_format[key[1]][stream]:
if (field in final_fields_format[key[0]][stream] and final_fields_format[key[1]][stream][field] == final_fields_format[key[0]][stream][field]):
pass
else:
removed_format[stream][field] = final_fields_format[key[1]][stream][field]
if list(final_fields[key[0]].keys()) == list(final_fields[key[1]].keys()):
for stream in final_fields[key[0]]:
is_equal = final_fields[key[0]][stream] == final_fields[key[1]][stream]
if not is_equal:
diff_streams.append(stream)
if len(diff_streams) != 0:
schema_compare(diff_streams)
else:
temp_streams_1 = list(final_fields[key[0]].keys())
temp_streams_2 = list(final_fields[key[1]].keys())
diff_streams_1 = list(set(temp_streams_1) - set(temp_streams_2))
temp_streams_3 = list(set(temp_streams_1) - set(diff_streams_1))
diff_streams = temp_streams_3
if len(diff_streams) != 0:
schema_compare(diff_streams)
if len(diff_streams_1) != 0:
for stream in diff_streams_1:
if stream in final_fields[key[0]]:
for field in final_fields[key[0]][stream]:
added_uncommon_pairs[stream][field] = final_fields[key[0]][stream][field]
if stream in final_fields_format[key[0]]:
for field in final_fields_format[key[0]][stream]:
added_format[stream][field] = final_fields_format[key[0]][stream][field]
diff_streams_1 = []
diff_streams_1 = list(set(temp_streams_2) - set(temp_streams_1))
if len(diff_streams_1) != 0:
for stream in diff_streams_1:
if stream in final_fields[key[1]]:
for field in final_fields[key[1]][stream]:
removed_uncommon_pairs[stream][field] = final_fields[key[1]][stream][field]
if stream in final_fields_format[key[1]]:
for field in final_fields_format[key[1]][stream]:
removed_format[stream][field] = final_fields_format[key[1]][stream][field]
return newly_added_fields, removed_fields, added_uncommon_pairs, removed_uncommon_pairs, final_fields_format, added_format, removed_format
def genrate_comparision_report(input_arr, main_file_path, streams, added_uncommon_pairs, removed_uncommon_pairs, newly_added_fields, removed_fields, updated_uncommon_pairs, ReplicationMethod, ReplicationKeys, automatic_fields, unsupported_fields, available_fields, added_format, removed_format):
top = '''
<!DOCTYPE html>
<html>
<style>
th, td {
border:1px solid black;
border-style: dotted;
vertical-align: top;
}
ul {
display: inline-block;
text-align: left;
}
div {
border:2px solid black;
}
</style>
<body>
'''
end_text = '''
</body>
</html>
'''
tap_names = []
branch_names = []
for branch in input_arr:
tap_names.append(input_arr[branch]['tap_name'])
branch_names.append(branch)
updated_format = defaultdict(dict)
if tap_names[0] == tap_names[1]:
tap_name = input_arr[branch_names[0]]['tap_name']
cmd_output = os.system('rm -rf '+main_file_path+'/'+tap_name+'_Comparision.html')
if cmd_output != 0:
sys.exit()
file = open(main_file_path+"/"+tap_name+"_Comparision.html","a")
file.write(top)
body = '''
<table style="width:100%; text-align: center"><td style='border:3px solid black; border-style: dashed;'><h1>Tap-{name}</h1>
<h2>{branch}</h2></td></table>
'''.format(name=tap_name, branch=branch_names[0]+' <---> '+branch_names[1])
file.write(body)
for y in list(set(streams[branch_names[0]]).union(set(streams[branch_names[1]]))):
file.write("<h3><a href='#{href_stream}'> ♦ {stream}</a></h3>".format(href_stream=y, stream=y))
for y in list(set(streams[branch_names[0]]).union(set(streams[branch_names[1]]))):
if (y in list(added_uncommon_pairs.keys())) and (y in list(removed_uncommon_pairs.keys())):
for field in added_uncommon_pairs[y]:
if field in list(removed_uncommon_pairs[y].keys()):
if added_uncommon_pairs[y][field] != removed_uncommon_pairs[y][field]:
updated_uncommon_pairs[y][field] = []
updated_uncommon_pairs[y][field].append(removed_uncommon_pairs[y][field])
updated_uncommon_pairs[y][field].append(added_uncommon_pairs[y][field])
for field in updated_uncommon_pairs[y]:
added_uncommon_pairs[y].pop(field)
removed_uncommon_pairs[y].pop(field)
if (y in list(added_format.keys())) and (y in list(removed_format.keys())):
for field in added_format[y]:
if field in list(removed_format[y].keys()):
if added_format[y][field] != removed_format[y][field]:
updated_format[y][field] = []
updated_format[y][field].append(removed_format[y][field])
updated_format[y][field].append(added_format[y][field])
for field in updated_format[y]:
added_format[y].pop(field)
removed_format[y].pop(field)
file.write("<h1 id={href_stream}><u>{stream}</u></h1><div class='row'><table style='width:100%;'><tr><td style='border:1.5px solid black; border-style: dashed;'>".format(href_stream=y, stream=y))
if (y in list(available_fields[branch_names[0]].keys())) and (y in list(available_fields[branch_names[1]].keys())):
if available_fields[branch_names[0]][y] != available_fields[branch_names[1]][y]:
file.write("<h3>Comparision of Inclusion Availbale Fields</h3>")
file.write("<table><tr><th style='border:1.5px solid black;'> {branch1} (Added) </th><th style='border:1.5px solid black;'> {branch2} (Removed) </th></tr>".format(branch1=branch_names[0], branch2=branch_names[1]))
file.write("<td style='border:1.5px solid black;'>")
file.write("<li>{added}</li>".format(added=list(set(available_fields[branch_names[0]][y]) - set(available_fields[branch_names[1]][y]))))
file.write("</td>")
file.write("<td style='border:1.5px solid black;'>")
file.write("<li>{added}</li>".format(added=list(set(available_fields[branch_names[1]][y]) - set(available_fields[branch_names[0]][y]))))
file.write("</td>")
file.write("</table>")
else:
file.write("<h4>No diff found for Inclusion Availbale Fields</h4>")
file.write("</td></tr>")
file.write("<tr><td style='border:1.5px solid black; border-style: dashed;'>")
if (y in list(automatic_fields[branch_names[0]].keys())) and (y in list(automatic_fields[branch_names[1]].keys())):
if automatic_fields[branch_names[0]][y] != automatic_fields[branch_names[1]][y]:
file.write("<h3>Comparision of Inclusion Automatic Fields</h3>")
file.write("<table><tr><th style='border:1.5px solid black;'> {branch1} (Added) </th><th style='border:1.5px solid black;'> {branch2} (Removed) </th></tr>".format(branch1=branch_names[0],
branch2=branch_names[1]))
file.write("<td style='border:1.5px solid black;'>")
file.write("<li>{added}</li>".format(added=list(set(automatic_fields[branch_names[0]][y]) - set(automatic_fields[branch_names[1]][y]))))
file.write("</td>")
file.write("<td style='border:1.5px solid black;'>")
file.write("<li>{added}</li>".format(added=list(set(automatic_fields[branch_names[1]][y]) - set(automatic_fields[branch_names[0]][y]))))
file.write("</td>")
file.write("</table>")
else:
file.write("<h4>No diff found for Inclusion Automatic Fields</h4>")
file.write("</td></tr>")
file.write("<tr><td style='border:1.5px solid black; border-style: dashed;'>")
if (y in list(unsupported_fields[branch_names[0]].keys())) and (y in list(unsupported_fields[branch_names[1]].keys())):
if unsupported_fields[branch_names[0]][y] != unsupported_fields[branch_names[1]][y]:
file.write("<h3>Comparision of Inclusion Unsupported Fields</h3>")
file.write("<table><tr><th style='border:1.5px solid black;'> {branch1}(Added) </th><th style='border:1.5px solid black;'> {branch2} (Removed) </th></tr>".format(branch1=branch_names[0], branch2=branch_names[1]))
file.write("<td style='border:1.5px solid black;'>")
file.write("<li>{added}</li>".format(added=list(set(unsupported_fields[branch_names[0]][y]) - set(unsupported_fields[branch_names[1]][y]))))
file.write("</td>")
file.write("<td style='border:1.5px solid black;'>")
file.write("<li>{added}</li>".format(added=list(set(unsupported_fields[branch_names[1]][y]) - set(unsupported_fields[branch_names[0]][y]))))
file.write("</td>")
file.write("</table>")
else:
file.write("<h4>No diff found for Inclusion Unsupported Fields</h4>")
file.write("</td></tr>")
file.write("<tr><td style='border:1.5px solid black; border-style: dashed;'>")
if (y in list(ReplicationMethod[branch_names[0]].keys())) and (y in list(ReplicationMethod[branch_names[1]].keys())):
if ReplicationMethod[branch_names[0]][y] != ReplicationMethod[branch_names[1]][y]:
file.write("<h3>Comparision of Replication Method</h3>")
file.write("<table><tr><th style='border:1.5px solid black;'> {branch1} </th><th style='border:1.5px solid black;'> {branch2} </th></tr>".format(branch1=branch_names[0], branch2=branch_names[1]))
file.write("<td style='border:1.5px solid black;'>")
file.write("<li>{added}</li>".format(added=ReplicationMethod[branch_names[0]][y]))
file.write("</td>")
file.write("<td style='border:1.5px solid black;'>")
file.write("<li>{added}</li>".format(added=ReplicationMethod[branch_names[1]][y]))
file.write("</td>")
file.write("</table>")
else:
file.write("<h4>No diff found in Replication Method</h4>")
file.write("</td></tr>")
file.write("<tr><td style='border:1.5px solid black; border-style: dashed;'>")
if (y in list(ReplicationKeys[branch_names[0]].keys())) and (y in list(ReplicationKeys[branch_names[1]].keys())):
if ReplicationKeys[branch_names[0]][y] != ReplicationKeys[branch_names[1]][y]:
file.write("<h3>Comparision of Replication Keys</h3>")
file.write("<table><tr><th style='border:1.5px solid black;'> {branch1} </th><th style='border:1.5px solid black;'> {branch2} </th></tr>".format(branch1=branch_names[0], branch2=branch_names[1]))
file.write("<td style='border:1.5px solid black;'>")
file.write("<li>{added}</li>".format(added=ReplicationKeys[branch_names[0]][y]))
file.write("</td>")
file.write("<td style='border:1.5px solid black;'>")
file.write("<li>{added}</li>".format(added=ReplicationKeys[branch_names[1]][y]))
file.write("</td>")
file.write("</table>")
else:
file.write("<h4>No diff found in Replication Keys</h4>")
file.write("</td></tr>")
file.write("<tr><td style='border:1.5px solid black; border-style: dashed;'>")
if (y in list(newly_added_fields.keys())) or (y in list(removed_fields.keys())):
if len(newly_added_fields[y]) != 0 or len(removed_fields[y]) != 0:
file.write("<h3>Comparision in Metadata</h3>")
file.write("<table><tr><th style='border:1.5px solid black;'> {branch1} (Added) </th><th style='border:1.5px solid black;'> {branch2} (Removed) </th></tr>".format(branch1=branch_names[0], branch2=branch_names[1]))
file.write("<td style='border:1.5px solid black;'>")
if y in list(newly_added_fields.keys()):
file.write("<ul>")
# newly_added_fields[y].sort()
for field in newly_added_fields[y]:
file.write("<li>{added}</li>".format(added=field))
file.write("</ul>")
file.write("</td>")
file.write("<td style='border:1.5px solid black;'>")
if y in list(removed_fields.keys()):
file.write("<ul>")
# removed_fields[y].sort()
for field in removed_fields[y]:
file.write("<li>{added}</li>".format(added=field))
file.write("</ul>")
file.write("</td>")
file.write("</table>")
else:
file.write("<h4>No diff found in Metadata</h4>")
file.write("</td></tr>")
file.write("<tr><td style='border:1.5px solid black; border-style: dashed;'>")
if y in list(added_uncommon_pairs.keys()) or y in list(removed_uncommon_pairs.keys()) or y in list(updated_uncommon_pairs.keys()) or y in list(added_format.keys()) or y in list(removed_format.keys()) or y in list(updated_format.keys()):
if len(added_uncommon_pairs[y]) != 0 or len(removed_uncommon_pairs[y]) != 0 or len(updated_uncommon_pairs[y]) != 0 or len(added_format[y]) != 0 or len(removed_format[y]) != 0 or len(updated_format[y]) != 0:
file.write("<h3>Comparision in Schemas</h3>")
file.write("<table><tr><th style='border:1.5px solid black;'> {branch1} (Added) </th><th style='border:1.5px solid black;'> {branch2} (Removed) </th><th style='border:1.5px solid black;'> Updated Schema </th></tr>".format(branch1=branch_names[0], branch2=branch_names[1]))
file.write("<td style='border:1.5px solid black;'>")
if y in list(added_uncommon_pairs.keys()) or y in list(added_format.keys()):
file.write("<table>")
if y not in list(added_uncommon_pairs.keys()):
added_uncommon_pairs[y]['-'] = '-'
if y not in list(added_format.keys()):
added_format[y]['-'] = '-'
temp_count = 0
for field in list(set(added_uncommon_pairs[y].keys()).union(set(added_format[y].keys()))):
if temp_count == 0:
file.write("<tr><td><p><b>Field</b></p></td><td style='border:1.5px solid black;'><b>-</b></td><td><p><b>Data Type</b></p></td><td><p><b>Format</b></p></td></tr>")
if field == "-":
pass
else:
if field not in added_format[y]:
formats_ref = '-'
else:
formats_ref=added_format[y][field]
if field not in added_uncommon_pairs[y]:
field_name_ref = 'No diff'
else:
field_name_ref = added_uncommon_pairs[y][field]
name_field = field.replace('.', ' -> ')
file.write("<tr><td style='text-align:left'>{added}</td><td style='border:1.5px solid black;'><b>-</b></td><td>{field_name}</td><td>{formats}</td></tr>".format(added=name_field, field_name=field_name_ref, formats=formats_ref))
temp_count += 1
file.write("</table>")
file.write("</td>")
file.write("<td style='border:1.5px solid black;'>")
if y in list(removed_uncommon_pairs.keys()) or y in list(removed_format.keys()):
file.write("<table>")
if y not in list(removed_uncommon_pairs.keys()):
removed_uncommon_pairs[y]['-'] = '-'
if y not in list(removed_format.keys()):
removed_format[y]['-'] = '-'
temp_count = 0
for field in list(set(removed_uncommon_pairs[y].keys()).union(set(removed_format[y].keys()))):
if temp_count == 0:
file.write("<tr><td><p><b>Field</b></p></td><td style='border:1.5px solid black;'><b>-</b></td><td><p><b>Data Type</b></p></td><td><p><b>Format</b></p></td></tr>")
if field == "-":
pass
else:
if field not in removed_format[y]:
formats_ref = '-'
else:
formats_ref=removed_format[y][field]
if field not in removed_uncommon_pairs[y]:
field_name_ref = 'No diff'
else:
field_name_ref = removed_uncommon_pairs[y][field]
name_field = field.replace('.', ' -> ')
file.write("<tr><td style='text-align:left'>{added}</td><td style='border:1.5px solid black;'><b>-</b></td><td>{field_name}</td><td>{formats}</td></tr>".format(added=name_field, field_name=field_name_ref, formats=formats_ref))
temp_count += 1
file.write("</table>")
file.write("</td>")
file.write("<td style='border:1.5px solid black;'>")
if y in list(updated_uncommon_pairs.keys()) or y in list(updated_format.keys()):
file.write("<table>")
if y not in list(updated_uncommon_pairs.keys()):
updated_uncommon_pairs[y]['-'] = '-'
if y not in list(updated_format.keys()):
updated_format[y]['-'] = '-'
temp_count = 0
for field in list(set(updated_uncommon_pairs[y].keys()).union(set(updated_format[y].keys()))):
if temp_count == 0:
file.write("<tr><td><p><b>Field</b></p></td><td style='border:1.5px solid black;'><b>-</b></td><td><p><b>Data Type</b></p></td><td><p><b>Format</b></p></td></tr>")
if field == "-":
pass
else:
if field not in updated_format[y]:
formats_ref = '-'
formats_ref_1 = ''
else:
formats_ref=updated_format[y][field][0]
formats_ref_1=updated_format[y][field][1]
if field not in updated_uncommon_pairs[y]:
field_name_ref = 'No diff'
field_name_ref_1 = ''
else:
field_name_ref = updated_uncommon_pairs[y][field][0]
field_name_ref_1 = updated_uncommon_pairs[y][field][1]
name_field = field.replace('.', ' -> ')
file.write("<tr><td style='text-align:left'>{updated}</td><td style='border:1.5px solid black;'><b>-</b></td><td>{field_name} -> {field_name_1}</td><td>{formats} -> {formats_1}</td></tr>".format(updated=name_field, field_name=field_name_ref, field_name_1=field_name_ref_1, formats=formats_ref, formats_1=formats_ref_1))
temp_count += 1
file.write("</table>")
file.write("</td>")
file.write("</table>")
else:
file.write("<h4>No diff found in Schemas</h4>")
file.write("</td></tr></table></div>")
file.write(end_text)
file.close()