)]}'
{"releasenotes/notes/add-delete-by-uuid-6266652db1c8bb98.yaml":[{"author":{"_account_id":5196,"name":"Matthew Treinish","email":"mtreinish@kortar.org","username":"treinish"},"change_message_id":"8f15670d827c71374da6a1e22913eccdf11781d6","unresolved":false,"context_lines":[{"line_number":3,"context_line":"  - New option delete_run_by_uuid, which allows for the deletion of a run"},{"line_number":4,"context_line":"    specified by a given uuid."},{"line_number":5,"context_line":"  - New option delete_test_runs_by_uuid, which allows for the deletion of"},{"line_number":6,"context_line":"    all test runs associated with a given run uuid."}],"source_content_type":"text/x-yaml","patch_set":7,"id":"9f6a8fd7_ddb74086","line":6,"updated":"2018-04-17 20:11:34.000000000","message":"We probably should call these db api functions instead of options.\n\nWhen I read these release notes now I\u0027m left kinda confused as a user because I assume option means a parameter on a function somewhere but this doesn\u0027t indicate which function at all.","commit_id":"9d37139ca26d01a58a6d41108eb13d4d75b795d4"}],"subunit2sql/db/api.py":[{"author":{"_account_id":5196,"name":"Matthew Treinish","email":"mtreinish@kortar.org","username":"treinish"},"change_message_id":"62e7fd900031d287e57b9cb9b703e6bc802ad636","unresolved":false,"context_lines":[{"line_number":1211,"context_line":"            synchronize_session\u003dFalse)"},{"line_number":1212,"context_line":"    # Delete the runs"},{"line_number":1213,"context_line":"    db_utils.model_query(models.Run, session).filter("},{"line_number":1214,"context_line":"        uuid\u003drun_uuid).delete(synchronize_session\u003dFalse)"},{"line_number":1215,"context_line":""},{"line_number":1216,"context_line":""},{"line_number":1217,"context_line":"def get_id_from_test_id(test_id, session\u003dNone):"}],"source_content_type":"text/x-python","patch_set":1,"id":"5f93b717_ec2661ce","line":1214,"updated":"2018-02-02 19:37:11.000000000","message":"FWIW, this delete operation should be accomplisable with a single query on the SQL side. I\u0027m not sure the exact syntax for this in the sqlalchemy ORM, but in mysql it would be something like:\n\n  DELETE runs, run_metadata FROM runs INNER JOIN run_metadata ON runs.id \u003d run_metadata.run_id WHERE runs.uuid \u003d\u003d run_uuid;\n\nI\u0027d have to check the sqlalchemy docs on how to translate that to the ORM though. I also don\u0027t know if that\u0027ll work with sqlite (I assume postgres has a similar mechanism)","commit_id":"12ba017fbea7563a540b695db1a8764d599cdee9"},{"author":{"_account_id":24728,"name":"megan guiney","email":"meganmguiney@gmail.com","username":"mguiney"},"change_message_id":"3ddbc304409c0c24d6b9410d2eefa829df69e73e","unresolved":false,"context_lines":[{"line_number":1211,"context_line":"            synchronize_session\u003dFalse)"},{"line_number":1212,"context_line":"    # Delete the runs"},{"line_number":1213,"context_line":"    db_utils.model_query(models.Run, session).filter("},{"line_number":1214,"context_line":"        uuid\u003drun_uuid).delete(synchronize_session\u003dFalse)"},{"line_number":1215,"context_line":""},{"line_number":1216,"context_line":""},{"line_number":1217,"context_line":"def get_id_from_test_id(test_id, session\u003dNone):"}],"source_content_type":"text/x-python","patch_set":1,"id":"5f93b717_6aeeac22","line":1214,"in_reply_to":"5f93b717_ec2661ce","updated":"2018-02-03 07:36:36.000000000","message":"I believe this will require to use a subquery nonetheless, but I will amend it.","commit_id":"12ba017fbea7563a540b695db1a8764d599cdee9"},{"author":{"_account_id":5196,"name":"Matthew Treinish","email":"mtreinish@kortar.org","username":"treinish"},"change_message_id":"b6ddac358bc8a2636a66a83c4cf0606b36c0d4c0","unresolved":false,"context_lines":[{"line_number":1223,"context_line":"    run_id \u003d get_run_id_from_uuid(run_uuid)"},{"line_number":1224,"context_line":""},{"line_number":1225,"context_line":"    # find and delete all runs associated the given run"},{"line_number":1226,"context_line":"    test_runs \u003d db_utils.model_query(models.TestRun, session).filter("},{"line_number":1227,"context_line":"        models.TestRun.run_id \u003d\u003d run_id)"},{"line_number":1228,"context_line":"    test_run_ids \u003d [x.__dict__[\u0027id\u0027] for x in test_runs.all()]"},{"line_number":1229,"context_line":"    test_runs.delete(synchronize_session\u003dFalse)"}],"source_content_type":"text/x-python","patch_set":2,"id":"df7087c5_26b0baf4","line":1226,"updated":"2018-03-08 16:28:06.000000000","message":"This is basically already done with the get_test_runs_by_run_id() you probably could just call that from here and get a list of TestRun model objects.","commit_id":"f9885bede774d6de4ee44ae8e07a1d5c27578692"},{"author":{"_account_id":24728,"name":"megan guiney","email":"meganmguiney@gmail.com","username":"mguiney"},"change_message_id":"2492a47abdd534a2b7e0999bac6b87b10a734f5d","unresolved":false,"context_lines":[{"line_number":1223,"context_line":"    run_id \u003d get_run_id_from_uuid(run_uuid)"},{"line_number":1224,"context_line":""},{"line_number":1225,"context_line":"    # find and delete all runs associated the given run"},{"line_number":1226,"context_line":"    test_runs \u003d db_utils.model_query(models.TestRun, session).filter("},{"line_number":1227,"context_line":"        models.TestRun.run_id \u003d\u003d run_id)"},{"line_number":1228,"context_line":"    test_run_ids \u003d [x.__dict__[\u0027id\u0027] for x in test_runs.all()]"},{"line_number":1229,"context_line":"    test_runs.delete(synchronize_session\u003dFalse)"}],"source_content_type":"text/x-python","patch_set":2,"id":"df7087c5_4004a915","line":1226,"in_reply_to":"df7087c5_26b0baf4","updated":"2018-03-09 01:38:18.000000000","message":"Done","commit_id":"f9885bede774d6de4ee44ae8e07a1d5c27578692"},{"author":{"_account_id":5196,"name":"Matthew Treinish","email":"mtreinish@kortar.org","username":"treinish"},"change_message_id":"b6ddac358bc8a2636a66a83c4cf0606b36c0d4c0","unresolved":false,"context_lines":[{"line_number":1225,"context_line":"    # find and delete all runs associated the given run"},{"line_number":1226,"context_line":"    test_runs \u003d db_utils.model_query(models.TestRun, session).filter("},{"line_number":1227,"context_line":"        models.TestRun.run_id \u003d\u003d run_id)"},{"line_number":1228,"context_line":"    test_run_ids \u003d [x.__dict__[\u0027id\u0027] for x in test_runs.all()]"},{"line_number":1229,"context_line":"    test_runs.delete(synchronize_session\u003dFalse)"},{"line_number":1230,"context_line":"    # search for any metadata linked to the run uuid"},{"line_number":1231,"context_line":"    for test_run_id in test_run_ids:"}],"source_content_type":"text/x-python","patch_set":2,"id":"df7087c5_a6edaaf0","line":1228,"updated":"2018-03-08 16:28:06.000000000","message":"You can just use x.id here instead of pulling it from the dict representation.","commit_id":"f9885bede774d6de4ee44ae8e07a1d5c27578692"},{"author":{"_account_id":24728,"name":"megan guiney","email":"meganmguiney@gmail.com","username":"mguiney"},"change_message_id":"2492a47abdd534a2b7e0999bac6b87b10a734f5d","unresolved":false,"context_lines":[{"line_number":1225,"context_line":"    # find and delete all runs associated the given run"},{"line_number":1226,"context_line":"    test_runs \u003d db_utils.model_query(models.TestRun, session).filter("},{"line_number":1227,"context_line":"        models.TestRun.run_id \u003d\u003d run_id)"},{"line_number":1228,"context_line":"    test_run_ids \u003d [x.__dict__[\u0027id\u0027] for x in test_runs.all()]"},{"line_number":1229,"context_line":"    test_runs.delete(synchronize_session\u003dFalse)"},{"line_number":1230,"context_line":"    # search for any metadata linked to the run uuid"},{"line_number":1231,"context_line":"    for test_run_id in test_run_ids:"}],"source_content_type":"text/x-python","patch_set":2,"id":"df7087c5_e0085d29","line":1228,"in_reply_to":"df7087c5_a6edaaf0","updated":"2018-03-09 01:38:18.000000000","message":"Done","commit_id":"f9885bede774d6de4ee44ae8e07a1d5c27578692"},{"author":{"_account_id":5196,"name":"Matthew Treinish","email":"mtreinish@kortar.org","username":"treinish"},"change_message_id":"28fb41ae3dc688c2134c8e3ebcf7d37df22667fc","unresolved":false,"context_lines":[{"line_number":1202,"context_line":"                    new session will be created."},{"line_number":1203,"context_line":"    \"\"\""},{"line_number":1204,"context_line":"    session \u003d session or get_session()"},{"line_number":1205,"context_line":"    run_id \u003d get_run_id_from_uuid(run_uuid)"},{"line_number":1206,"context_line":""},{"line_number":1207,"context_line":"    # find and delete any runs"},{"line_number":1208,"context_line":"    db_utils.model_query(models.Run, session).filter("}],"source_content_type":"text/x-python","patch_set":6,"id":"bf659307_56d94c1f","line":1205,"updated":"2018-04-02 04:23:43.000000000","message":"You should pass the session object here so all the db operations are in the same session.","commit_id":"de360e68fa0060de30b37fc39989ac0617434106"},{"author":{"_account_id":24728,"name":"megan guiney","email":"meganmguiney@gmail.com","username":"mguiney"},"change_message_id":"f69d5c6358f7b41d1209c2ef02c802bbb49f97d3","unresolved":false,"context_lines":[{"line_number":1202,"context_line":"                    new session will be created."},{"line_number":1203,"context_line":"    \"\"\""},{"line_number":1204,"context_line":"    session \u003d session or get_session()"},{"line_number":1205,"context_line":"    run_id \u003d get_run_id_from_uuid(run_uuid)"},{"line_number":1206,"context_line":""},{"line_number":1207,"context_line":"    # find and delete any runs"},{"line_number":1208,"context_line":"    db_utils.model_query(models.Run, session).filter("}],"source_content_type":"text/x-python","patch_set":6,"id":"bf659307_bc975e48","line":1205,"in_reply_to":"bf659307_56d94c1f","updated":"2018-04-02 20:53:21.000000000","message":"Done","commit_id":"de360e68fa0060de30b37fc39989ac0617434106"},{"author":{"_account_id":5196,"name":"Matthew Treinish","email":"mtreinish@kortar.org","username":"treinish"},"change_message_id":"28fb41ae3dc688c2134c8e3ebcf7d37df22667fc","unresolved":false,"context_lines":[{"line_number":1222,"context_line":"    session \u003d session or get_session()"},{"line_number":1223,"context_line":""},{"line_number":1224,"context_line":"    # find and delete all runs associated the given run"},{"line_number":1225,"context_line":"    test_runs \u003d get_test_runs_by_run_id(run_uuid)"},{"line_number":1226,"context_line":"    test_run_ids \u003d [x.test_id for x in test_runs]"},{"line_number":1227,"context_line":"    for test_run_id in test_run_ids:"},{"line_number":1228,"context_line":"        db_utils.model_query(models.TestRun, session). \\"}],"source_content_type":"text/x-python","patch_set":6,"id":"bf659307_f6e8a0b3","line":1225,"updated":"2018-04-02 04:23:43.000000000","message":"You should pass the session object here so all the db operations are in the same session.","commit_id":"de360e68fa0060de30b37fc39989ac0617434106"},{"author":{"_account_id":24728,"name":"megan guiney","email":"meganmguiney@gmail.com","username":"mguiney"},"change_message_id":"f69d5c6358f7b41d1209c2ef02c802bbb49f97d3","unresolved":false,"context_lines":[{"line_number":1222,"context_line":"    session \u003d session or get_session()"},{"line_number":1223,"context_line":""},{"line_number":1224,"context_line":"    # find and delete all runs associated the given run"},{"line_number":1225,"context_line":"    test_runs \u003d get_test_runs_by_run_id(run_uuid)"},{"line_number":1226,"context_line":"    test_run_ids \u003d [x.test_id for x in test_runs]"},{"line_number":1227,"context_line":"    for test_run_id in test_run_ids:"},{"line_number":1228,"context_line":"        db_utils.model_query(models.TestRun, session). \\"}],"source_content_type":"text/x-python","patch_set":6,"id":"bf659307_9c67fab7","line":1225,"in_reply_to":"bf659307_f6e8a0b3","updated":"2018-04-02 20:53:21.000000000","message":"Done","commit_id":"de360e68fa0060de30b37fc39989ac0617434106"},{"author":{"_account_id":5196,"name":"Matthew Treinish","email":"mtreinish@kortar.org","username":"treinish"},"change_message_id":"28fb41ae3dc688c2134c8e3ebcf7d37df22667fc","unresolved":false,"context_lines":[{"line_number":1223,"context_line":""},{"line_number":1224,"context_line":"    # find and delete all runs associated the given run"},{"line_number":1225,"context_line":"    test_runs \u003d get_test_runs_by_run_id(run_uuid)"},{"line_number":1226,"context_line":"    test_run_ids \u003d [x.test_id for x in test_runs]"},{"line_number":1227,"context_line":"    for test_run_id in test_run_ids:"},{"line_number":1228,"context_line":"        db_utils.model_query(models.TestRun, session). \\"},{"line_number":1229,"context_line":"            filter(models.TestRun.id \u003d\u003d test_run_id). \\"}],"source_content_type":"text/x-python","patch_set":6,"id":"bf659307_b6cea857","line":1226,"updated":"2018-04-02 04:23:43.000000000","message":"This is the wrong id isn\u0027t it? The test_id should be the foreign key for the id column in the tests table. Don\u0027t you want this to be the id column for the test_runs table? (the index of the test_runs table)","commit_id":"de360e68fa0060de30b37fc39989ac0617434106"},{"author":{"_account_id":24728,"name":"megan guiney","email":"meganmguiney@gmail.com","username":"mguiney"},"change_message_id":"f69d5c6358f7b41d1209c2ef02c802bbb49f97d3","unresolved":false,"context_lines":[{"line_number":1223,"context_line":""},{"line_number":1224,"context_line":"    # find and delete all runs associated the given run"},{"line_number":1225,"context_line":"    test_runs \u003d get_test_runs_by_run_id(run_uuid)"},{"line_number":1226,"context_line":"    test_run_ids \u003d [x.test_id for x in test_runs]"},{"line_number":1227,"context_line":"    for test_run_id in test_run_ids:"},{"line_number":1228,"context_line":"        db_utils.model_query(models.TestRun, session). \\"},{"line_number":1229,"context_line":"            filter(models.TestRun.id \u003d\u003d test_run_id). \\"}],"source_content_type":"text/x-python","patch_set":6,"id":"bf659307_9c985a75","line":1226,"in_reply_to":"bf659307_b6cea857","updated":"2018-04-02 20:53:21.000000000","message":"ah, good catch. It appears that I typo\u0027d that along the way.","commit_id":"de360e68fa0060de30b37fc39989ac0617434106"}],"subunit2sql/tests/db/test_api.py":[{"author":{"_account_id":5196,"name":"Matthew Treinish","email":"mtreinish@kortar.org","username":"treinish"},"change_message_id":"b6ddac358bc8a2636a66a83c4cf0606b36c0d4c0","unresolved":false,"context_lines":[{"line_number":618,"context_line":"        uuid_to_keep \u003d \u0027e5e13a8a-604e-4a36-b0c8-6c7c8e7b4fe1\u0027"},{"line_number":619,"context_line":"        metadata_a \u003d {\u0027key\u0027: \u0027This is the metadata we\\\u0027re keeping\u0027}"},{"line_number":620,"context_line":"        metadata_b \u003d {\u0027key\u0027: \u0027This metadata should be removed\u0027}"},{"line_number":621,"context_line":"        run_a \u003d api.create_run(uuid\u003duuid_to_delete)"},{"line_number":622,"context_line":"        run_b \u003d api.create_run(uuid\u003duuid_to_keep)"},{"line_number":623,"context_line":"        api.add_run_metadata(metadata_a, run_a.id)"},{"line_number":624,"context_line":"        api.add_run_metadata(metadata_b, run_b.id)"}],"source_content_type":"text/x-python","patch_set":2,"id":"df7087c5_e61e420b","line":621,"updated":"2018-03-08 16:28:06.000000000","message":"uuid isn\u0027t actually a parameter on create_run() if you want to set the uuid field you can specify it with the id kwarg. \n\nhttps://docs.openstack.org/subunit2sql/latest/_modules/subunit2sql/db/api.html#create_run\n\nOr you can just not set an id and just pull it from the result with uuid_to_delete \u003d run_a.uuid","commit_id":"f9885bede774d6de4ee44ae8e07a1d5c27578692"},{"author":{"_account_id":24728,"name":"megan guiney","email":"meganmguiney@gmail.com","username":"mguiney"},"change_message_id":"2492a47abdd534a2b7e0999bac6b87b10a734f5d","unresolved":false,"context_lines":[{"line_number":618,"context_line":"        uuid_to_keep \u003d \u0027e5e13a8a-604e-4a36-b0c8-6c7c8e7b4fe1\u0027"},{"line_number":619,"context_line":"        metadata_a \u003d {\u0027key\u0027: \u0027This is the metadata we\\\u0027re keeping\u0027}"},{"line_number":620,"context_line":"        metadata_b \u003d {\u0027key\u0027: \u0027This metadata should be removed\u0027}"},{"line_number":621,"context_line":"        run_a \u003d api.create_run(uuid\u003duuid_to_delete)"},{"line_number":622,"context_line":"        run_b \u003d api.create_run(uuid\u003duuid_to_keep)"},{"line_number":623,"context_line":"        api.add_run_metadata(metadata_a, run_a.id)"},{"line_number":624,"context_line":"        api.add_run_metadata(metadata_b, run_b.id)"}],"source_content_type":"text/x-python","patch_set":2,"id":"df7087c5_60352dda","line":621,"in_reply_to":"df7087c5_e61e420b","updated":"2018-03-09 01:38:18.000000000","message":"yes, I feel rather silly about this in retrospect. already had it sorted for the next version of the patch, just haven\u0027t gotten that finished off yet.","commit_id":"f9885bede774d6de4ee44ae8e07a1d5c27578692"},{"author":{"_account_id":5196,"name":"Matthew Treinish","email":"mtreinish@kortar.org","username":"treinish"},"change_message_id":"28fb41ae3dc688c2134c8e3ebcf7d37df22667fc","unresolved":false,"context_lines":[{"line_number":487,"context_line":"        self.assertIn(timestamp_b, result.keys())"},{"line_number":488,"context_line":"        for timestamp in result:"},{"line_number":489,"context_line":"            if timestamp.replace("},{"line_number":490,"context_line":"                    microsecond\u003d0) \u003d\u003d timestamp_a.replace(microsecond\u003d0):"},{"line_number":491,"context_line":"                self.assertEqual(5, result[timestamp])"},{"line_number":492,"context_line":"            else:"},{"line_number":493,"context_line":"                self.assertEqual(2, result[timestamp])"}],"source_content_type":"text/x-python","patch_set":6,"id":"bf659307_76d490e9","line":490,"updated":"2018-04-02 04:23:43.000000000","message":"I don\u0027t think this is a related change","commit_id":"de360e68fa0060de30b37fc39989ac0617434106"}]}
