)]}'
{"nova/db/sqlalchemy/api.py":[{"author":{"_account_id":6172,"name":"Boris Pavlovic","email":"boris@pavlovic.me","username":"boris-42"},"change_message_id":"d787ef8d29d927d146f2c15faf892188c8e69860","unresolved":false,"context_lines":[{"line_number":2765,"context_line":"            usage.in_use +\u003d reservation.delta"},{"line_number":2766,"context_line":"        reservation_query.soft_delete(synchronize_session\u003dFalse)"},{"line_number":2767,"context_line":""},{"line_number":2768,"context_line":"        for usage in usages.values():"},{"line_number":2769,"context_line":"            usage.save(session\u003dsession)"},{"line_number":2770,"context_line":""},{"line_number":2771,"context_line":""}],"source_content_type":"text/x-python","patch_set":1,"id":"AAAAM3%2F%2F54w%3D","line":2768,"updated":"2012-12-21 18:53:34.000000000","message":"There is no need to make this loop. It will be removed in next patch.","commit_id":"f179ba0ab86465d8e1e37d6ecd07efe53c663789"},{"author":{"_account_id":6172,"name":"Boris Pavlovic","email":"boris@pavlovic.me","username":"boris-42"},"change_message_id":"62b4864b578d94f100b1df134ee2174bbb592070","unresolved":false,"context_lines":[{"line_number":2765,"context_line":"            usage.in_use +\u003d reservation.delta"},{"line_number":2766,"context_line":"        reservation_query.soft_delete(synchronize_session\u003dFalse)"},{"line_number":2767,"context_line":""},{"line_number":2768,"context_line":"        for usage in usages.values():"},{"line_number":2769,"context_line":"            usage.save(session\u003dsession)"},{"line_number":2770,"context_line":""},{"line_number":2771,"context_line":""}],"source_content_type":"text/x-python","patch_set":1,"id":"AAAAM3%2F%2F5zc%3D","line":2768,"in_reply_to":"AAAAM3%2F%2F53A%3D","updated":"2012-12-21 20:38:46.000000000","message":"Here is a hidden functionality of sqlaclhemy: \nWhat does model.save() method: \nsession.add(instance)\nsession.flush() \n\nAnd what we have: \nFirst of all we have already all usages instance in session.\nSo we don\u0027t need to make session.add(instance). \n \nWhen we change their values they will be marked as dirty.\n\nSo when we make session.flush() sqlalchemy will send db request for all dirty usages (to update their values). \n\nAnd last one: What makes with session.begin() construction. \n\nin method session.__exit__() will be such call chain: \nsession.commit() -\u003e session.transaction.commit() -\u003e session.flush() \nSo it wil automatically call session.flush() that will update all dirty usages. \n\nSo this loop does nothing.","commit_id":"f179ba0ab86465d8e1e37d6ecd07efe53c663789"},{"author":{"_account_id":679,"name":"Kevin L. Mitchell","email":"klmitch@mit.edu","username":"klmitch"},"change_message_id":"4ef3c4f1e33b3166676804970b68b8f64d2fd2f0","unresolved":false,"context_lines":[{"line_number":2765,"context_line":"            usage.in_use +\u003d reservation.delta"},{"line_number":2766,"context_line":"        reservation_query.soft_delete(synchronize_session\u003dFalse)"},{"line_number":2767,"context_line":""},{"line_number":2768,"context_line":"        for usage in usages.values():"},{"line_number":2769,"context_line":"            usage.save(session\u003dsession)"},{"line_number":2770,"context_line":""},{"line_number":2771,"context_line":""}],"source_content_type":"text/x-python","patch_set":1,"id":"AAAAM3%2F%2F53A%3D","line":2768,"in_reply_to":"AAAAM3%2F%2F54w%3D","updated":"2012-12-21 19:46:38.000000000","message":"The usage records are updated by the previous loop, though; how does the usage get updated without this loop?","commit_id":"f179ba0ab86465d8e1e37d6ecd07efe53c663789"},{"author":{"_account_id":679,"name":"Kevin L. Mitchell","email":"klmitch@mit.edu","username":"klmitch"},"change_message_id":"0baf83c93e1a9dfb5386d74617da0e50a8a7dc3b","unresolved":false,"context_lines":[{"line_number":2765,"context_line":"            usage.in_use +\u003d reservation.delta"},{"line_number":2766,"context_line":"        reservation_query.soft_delete(synchronize_session\u003dFalse)"},{"line_number":2767,"context_line":""},{"line_number":2768,"context_line":"        for usage in usages.values():"},{"line_number":2769,"context_line":"            usage.save(session\u003dsession)"},{"line_number":2770,"context_line":""},{"line_number":2771,"context_line":""}],"source_content_type":"text/x-python","patch_set":1,"id":"AAAAM3%2F%2F5wk%3D","line":2768,"in_reply_to":"AAAAM3%2F%2F5zc%3D","updated":"2012-12-21 21:53:12.000000000","message":"OK, I suppose that makes sense.  (And herein is the argument against \"magic\" actions, but I digress :)","commit_id":"f179ba0ab86465d8e1e37d6ecd07efe53c663789"}]}
