import json path = "fixtures/database.json" with open(path, "r") as f: data = json.load(f) test_case = data[-1] test_case["database"]["relations"] = [ { "id": "r1", "type": "relation", "constraint": "fk_person_email", "source_type": "person", "source_columns": ["email_id"], "destination_type": "email_address", "destination_columns": ["id"], "prefix": "email" }, { "id": "r2", "type": "relation", "constraint": "fk_person_ad_hoc_bubble", "source_type": "person", "source_columns": ["ad_hoc_bubble_id"], "destination_type": "some_bubble", "destination_columns": ["id"], "prefix": "ad_hoc_bubble" }, { "id": "r3", "type": "relation", "constraint": "fk_person_generic_bubble", "source_type": "person", "source_columns": ["generic_bubble_id"], "destination_type": "some_bubble", "destination_columns": ["id"], "prefix": "generic_bubble" }, { "id": "r4", "type": "relation", "constraint": "fk_person_extended_relations", "source_type": "contact", "source_columns": ["source_id"], "destination_type": "person", "destination_columns": ["id"], "prefix": "extended_relations" }, { "id": "r5", "type": "relation", "constraint": "fk_person_standard_relations", "source_type": "contact", "source_columns": ["source_id_2"], "destination_type": "person", "destination_columns": ["id"], "prefix": "standard_relations" }, { "id": "r6", "type": "relation", "constraint": "fk_contact_target", "source_type": "contact", "source_columns": ["target_id"], "destination_type": "email_address", "destination_columns": ["id"], "prefix": "target" } ] with open(path, "w") as f: json.dump(data, f, indent=2)