)]}'
{"mistral/db/v2/sqlalchemy/api.py":[{"author":{"_account_id":9029,"name":"Moshe Elisha","email":"moshe.elisha@nokia.com","username":"MosheElisha"},"change_message_id":"1fd4c8050f6c98f87773b6f14ff6920679792863","unresolved":false,"context_lines":[{"line_number":301,"context_line":"    replace \u003d None"},{"line_number":302,"context_line":""},{"line_number":303,"context_line":"    if b.get_driver_name() \u003d\u003d \u0027sqlite\u0027:"},{"line_number":304,"context_line":"        replace \u003d (\u0027INSERT INTO\u0027, \u0027INSERT OR IGNORE INTO\u0027)"},{"line_number":305,"context_line":"    elif b.get_driver_name() \u003d\u003d \u0027mysql\u0027:"},{"line_number":306,"context_line":"        append \u003d \u0027ON DUPLICATE KEY UPDATE id\u003did\u0027"},{"line_number":307,"context_line":"    elif b.get_driver_name() \u003d\u003d \u0027postgres\u0027:"}],"source_content_type":"text/x-python","patch_set":4,"id":"bacf61ea_c4cca863","line":304,"updated":"2016-08-04 08:34:54.000000000","message":"I am worried that if INSERT will fail due to a reason other than conflict - the insert statement will still fail.\n\nCan you please verify if my concern is correct?\nIf so, I would recommend to replace \"INSERT INTO\" with \"REPLACE INTO\"","commit_id":"eb4ac71c8520dd78b464b3c4018a0132e3c67b62"},{"author":{"_account_id":8731,"name":"Renat Akhmerov","email":"renat.akhmerov@gmail.com","username":"rakhmerov"},"change_message_id":"93a00a0ef7e63666a882955990fdaecba5b5eccc","unresolved":false,"context_lines":[{"line_number":301,"context_line":"    replace \u003d None"},{"line_number":302,"context_line":""},{"line_number":303,"context_line":"    if b.get_driver_name() \u003d\u003d \u0027sqlite\u0027:"},{"line_number":304,"context_line":"        replace \u003d (\u0027INSERT INTO\u0027, \u0027INSERT OR IGNORE INTO\u0027)"},{"line_number":305,"context_line":"    elif b.get_driver_name() \u003d\u003d \u0027mysql\u0027:"},{"line_number":306,"context_line":"        append \u003d \u0027ON DUPLICATE KEY UPDATE id\u003did\u0027"},{"line_number":307,"context_line":"    elif b.get_driver_name() \u003d\u003d \u0027postgres\u0027:"}],"source_content_type":"text/x-python","patch_set":4,"id":"bacf61ea_f4622fd7","line":304,"in_reply_to":"bacf61ea_7b359244","updated":"2016-08-04 11:50:04.000000000","message":"Seems like my reply was not precise enough so here\u0027s some more info.\n\nIn case of sqlite \"OR IGNORE\" will really hide some other errors according to  https://www.sqlite.org/lang_conflict.html. It\u0027s good though that FK constraint violations are not swallowed. But it\u0027s a trade-off we can accept I think because this method is for very special needs and most of the time we\u0027ll be inserting objects using different methods. And it will all be covered by lots of tests. I think this is acceptable.\n\n\"REPLACE INTO\" can\u0027t be used because it always returns row count 1 because it implicitly always does \"DELETE FROM\" and then \"INSERT INTO\".","commit_id":"eb4ac71c8520dd78b464b3c4018a0132e3c67b62"},{"author":{"_account_id":8731,"name":"Renat Akhmerov","email":"renat.akhmerov@gmail.com","username":"rakhmerov"},"change_message_id":"debe49dfb07bfdeefde4985ddcc4f41b334be64d","unresolved":false,"context_lines":[{"line_number":301,"context_line":"    replace \u003d None"},{"line_number":302,"context_line":""},{"line_number":303,"context_line":"    if b.get_driver_name() \u003d\u003d \u0027sqlite\u0027:"},{"line_number":304,"context_line":"        replace \u003d (\u0027INSERT INTO\u0027, \u0027INSERT OR IGNORE INTO\u0027)"},{"line_number":305,"context_line":"    elif b.get_driver_name() \u003d\u003d \u0027mysql\u0027:"},{"line_number":306,"context_line":"        append \u003d \u0027ON DUPLICATE KEY UPDATE id\u003did\u0027"},{"line_number":307,"context_line":"    elif b.get_driver_name() \u003d\u003d \u0027postgres\u0027:"}],"source_content_type":"text/x-python","patch_set":4,"id":"bacf61ea_7b359244","line":304,"in_reply_to":"bacf61ea_c4cca863","updated":"2016-08-04 11:09:49.000000000","message":"This is fine because this method deals only with unique constraint violations and is not assumed to handle other situations. REPLACE INTO has its own downsides (e.g. much worse performance) and I think we need to avoid using it.\n\nWe just need to keep in mind what applicability of this method is.","commit_id":"eb4ac71c8520dd78b464b3c4018a0132e3c67b62"},{"author":{"_account_id":9029,"name":"Moshe Elisha","email":"moshe.elisha@nokia.com","username":"MosheElisha"},"change_message_id":"e296c97e757705cf15ccfe1541599f6f6f11e2b7","unresolved":false,"context_lines":[{"line_number":301,"context_line":"    replace \u003d None"},{"line_number":302,"context_line":""},{"line_number":303,"context_line":"    if b.get_driver_name() \u003d\u003d \u0027sqlite\u0027:"},{"line_number":304,"context_line":"        replace \u003d (\u0027INSERT INTO\u0027, \u0027INSERT OR IGNORE INTO\u0027)"},{"line_number":305,"context_line":"    elif b.get_driver_name() \u003d\u003d \u0027mysql\u0027:"},{"line_number":306,"context_line":"        append \u003d \u0027ON DUPLICATE KEY UPDATE id\u003did\u0027"},{"line_number":307,"context_line":"    elif b.get_driver_name() \u003d\u003d \u0027postgres\u0027:"}],"source_content_type":"text/x-python","patch_set":4,"id":"bacf61ea_1461c3a8","line":304,"in_reply_to":"bacf61ea_f4622fd7","updated":"2016-08-04 11:53:58.000000000","message":"Done","commit_id":"eb4ac71c8520dd78b464b3c4018a0132e3c67b62"},{"author":{"_account_id":9029,"name":"Moshe Elisha","email":"moshe.elisha@nokia.com","username":"MosheElisha"},"change_message_id":"1fd4c8050f6c98f87773b6f14ff6920679792863","unresolved":false,"context_lines":[{"line_number":303,"context_line":"    if b.get_driver_name() \u003d\u003d \u0027sqlite\u0027:"},{"line_number":304,"context_line":"        replace \u003d (\u0027INSERT INTO\u0027, \u0027INSERT OR IGNORE INTO\u0027)"},{"line_number":305,"context_line":"    elif b.get_driver_name() \u003d\u003d \u0027mysql\u0027:"},{"line_number":306,"context_line":"        append \u003d \u0027ON DUPLICATE KEY UPDATE id\u003did\u0027"},{"line_number":307,"context_line":"    elif b.get_driver_name() \u003d\u003d \u0027postgres\u0027:"},{"line_number":308,"context_line":"        append \u003d \u0027ON CONFLICT DO NOTHING\u0027"},{"line_number":309,"context_line":"    else:"}],"source_content_type":"text/x-python","patch_set":4,"id":"bacf61ea_44ca781b","line":306,"updated":"2016-08-04 08:34:54.000000000","message":"Can we update some other column we can assume will always exist?\n\n\nI am worried that updating the PK (even to the same value) will trigger all kind of re-indexing, ...\nMaybe MySQL is smart enough to understand that no change was made... I am not sure.","commit_id":"eb4ac71c8520dd78b464b3c4018a0132e3c67b62"},{"author":{"_account_id":8731,"name":"Renat Akhmerov","email":"renat.akhmerov@gmail.com","username":"rakhmerov"},"change_message_id":"debe49dfb07bfdeefde4985ddcc4f41b334be64d","unresolved":false,"context_lines":[{"line_number":303,"context_line":"    if b.get_driver_name() \u003d\u003d \u0027sqlite\u0027:"},{"line_number":304,"context_line":"        replace \u003d (\u0027INSERT INTO\u0027, \u0027INSERT OR IGNORE INTO\u0027)"},{"line_number":305,"context_line":"    elif b.get_driver_name() \u003d\u003d \u0027mysql\u0027:"},{"line_number":306,"context_line":"        append \u003d \u0027ON DUPLICATE KEY UPDATE id\u003did\u0027"},{"line_number":307,"context_line":"    elif b.get_driver_name() \u003d\u003d \u0027postgres\u0027:"},{"line_number":308,"context_line":"        append \u003d \u0027ON CONFLICT DO NOTHING\u0027"},{"line_number":309,"context_line":"    else:"}],"source_content_type":"text/x-python","patch_set":4,"id":"bacf61ea_bedd3872","line":306,"in_reply_to":"bacf61ea_44ca781b","updated":"2016-08-04 11:09:49.000000000","message":"I found these two sources:\n\n* http://dba.stackexchange.com/questions/134696/does-mysql-updated-index-if-index-key-is-not-updated?rq\u003d1\n* http://dev.mysql.com/doc/refman/5.7/en/update-speed.html\n\nfrom which I can conclude that MySQL does all kinds of optimizations to prevent unnecessary index updates so I\u0027m confident about this. It would be weird if they didn\u0027t handle such a simple corner case.","commit_id":"eb4ac71c8520dd78b464b3c4018a0132e3c67b62"},{"author":{"_account_id":9029,"name":"Moshe Elisha","email":"moshe.elisha@nokia.com","username":"MosheElisha"},"change_message_id":"e296c97e757705cf15ccfe1541599f6f6f11e2b7","unresolved":false,"context_lines":[{"line_number":303,"context_line":"    if b.get_driver_name() \u003d\u003d \u0027sqlite\u0027:"},{"line_number":304,"context_line":"        replace \u003d (\u0027INSERT INTO\u0027, \u0027INSERT OR IGNORE INTO\u0027)"},{"line_number":305,"context_line":"    elif b.get_driver_name() \u003d\u003d \u0027mysql\u0027:"},{"line_number":306,"context_line":"        append \u003d \u0027ON DUPLICATE KEY UPDATE id\u003did\u0027"},{"line_number":307,"context_line":"    elif b.get_driver_name() \u003d\u003d \u0027postgres\u0027:"},{"line_number":308,"context_line":"        append \u003d \u0027ON CONFLICT DO NOTHING\u0027"},{"line_number":309,"context_line":"    else:"}],"source_content_type":"text/x-python","patch_set":4,"id":"bacf61ea_1ea444b7","line":306,"in_reply_to":"bacf61ea_bedd3872","updated":"2016-08-04 11:53:58.000000000","message":"Done","commit_id":"eb4ac71c8520dd78b464b3c4018a0132e3c67b62"}]}
