)]}'
{"nova/db/sqlalchemy/session.py":[{"author":{"_account_id":4146,"name":"Clark Boylan","email":"cboylan@sapwetik.org","username":"cboylan"},"change_message_id":"8ce087f6e733191bd52ea3e2f82589a1bbd0a7fb","unresolved":false,"context_lines":[{"line_number":52,"context_line":"        return foo_ref"},{"line_number":53,"context_line":""},{"line_number":54,"context_line":""},{"line_number":55,"context_line":"* Within the scope of a single method, keeping all the reads and writes inside"},{"line_number":56,"context_line":"  a scoped session. In this way, the session\u0027s __exit__ handler will take care"},{"line_number":57,"context_line":"  of calling flush() and commit() for you. If using this approach, you should"},{"line_number":58,"context_line":"  not explicitly call flush() or commit(). Any error within the scope of the"}],"source_content_type":"text/x-python","patch_set":2,"id":"AAAALn%2F%2F57w%3D","line":55,"updated":"2012-10-29 17:20:34.000000000","message":"Using context manager terminology might be less ambiguous here. Something like \"keep all reads and writes within a context managed by the session.\" Then later \"Any error within the context of the session will cause the database to rollback the transaction.\"","commit_id":"4a1ee0fd5c01eb9d961a30540f033cf6f617f39b"},{"author":{"_account_id":2889,"name":"Aeva Black","email":"aeva.online@gmail.com","username":"tenbrae"},"change_message_id":"83851f410b6dec6a94b861df3da776adba10128a","unresolved":false,"context_lines":[{"line_number":52,"context_line":"        return foo_ref"},{"line_number":53,"context_line":""},{"line_number":54,"context_line":""},{"line_number":55,"context_line":"* Within the scope of a single method, keeping all the reads and writes inside"},{"line_number":56,"context_line":"  a scoped session. In this way, the session\u0027s __exit__ handler will take care"},{"line_number":57,"context_line":"  of calling flush() and commit() for you. If using this approach, you should"},{"line_number":58,"context_line":"  not explicitly call flush() or commit(). Any error within the scope of the"}],"source_content_type":"text/x-python","patch_set":2,"id":"AAAALn%2F%2F57c%3D","line":55,"in_reply_to":"AAAALn%2F%2F57w%3D","updated":"2012-10-29 17:26:04.000000000","message":"Yes! Thanks, updating.","commit_id":"4a1ee0fd5c01eb9d961a30540f033cf6f617f39b"},{"author":{"_account_id":159,"name":"Eric Windisch","email":"ewindisch@docker.com","username":"ewindisch"},"change_message_id":"b1b8feb9a719e2035bcb0e1030c33ab117a21364","unresolved":false,"context_lines":[{"line_number":18,"context_line":""},{"line_number":19,"context_line":"\"\"\"Session Handling for SQLAlchemy backend."},{"line_number":20,"context_line":""},{"line_number":21,"context_line":"Recommeded ways to use sessions within this framework:"},{"line_number":22,"context_line":""},{"line_number":23,"context_line":"* Don\u0027t use them explicitly; this is like running with AUTOCOMMIT\u003d1."},{"line_number":24,"context_line":"  model_query() will implicitly use a session when called without one"}],"source_content_type":"text/x-python","patch_set":3,"id":"AAAALn%2F%2F55o%3D","line":21,"updated":"2012-10-29 17:42:46.000000000","message":"spelling: recommended","commit_id":"fb17f1c48d6bbf933d7bc2230fefaa44fd1dccc0"},{"author":{"_account_id":67,"name":"Vish Ishaya","email":"vishvananda@gmail.com","username":"vishvananda"},"change_message_id":"1900b1be2be266363e1075d02b65c5a715f18653","unresolved":false,"context_lines":[{"line_number":83,"context_line":"                        filter_by(id\u003dfoo_ref[\u0027bar_id\u0027]).\\"},{"line_number":84,"context_line":"                        update({\u0027bar\u0027: newbar})"},{"line_number":85,"context_line":""},{"line_number":86,"context_line":"  Note: update_foo is a trivially simple example of using \"with session.begin\"."},{"line_number":87,"context_line":"  Whereas create_many_foo is a good example of when a transaction is needed,"},{"line_number":88,"context_line":"  it is always best to use as few queries as possible. The two queries in"},{"line_number":89,"context_line":"  update_foo can be better expressed using a single query which avoids"}],"source_content_type":"text/x-python","patch_set":3,"id":"AAAALn%2F%2F5yE%3D","line":86,"updated":"2012-10-29 19:00:24.000000000","message":"s/update_foo/update_bar/","commit_id":"fb17f1c48d6bbf933d7bc2230fefaa44fd1dccc0"},{"author":{"_account_id":2889,"name":"Aeva Black","email":"aeva.online@gmail.com","username":"tenbrae"},"change_message_id":"a6d5f00241771ea5e9a0aa09118be276cdd2f579","unresolved":false,"context_lines":[{"line_number":83,"context_line":"                        filter_by(id\u003dfoo_ref[\u0027bar_id\u0027]).\\"},{"line_number":84,"context_line":"                        update({\u0027bar\u0027: newbar})"},{"line_number":85,"context_line":""},{"line_number":86,"context_line":"  Note: update_foo is a trivially simple example of using \"with session.begin\"."},{"line_number":87,"context_line":"  Whereas create_many_foo is a good example of when a transaction is needed,"},{"line_number":88,"context_line":"  it is always best to use as few queries as possible. The two queries in"},{"line_number":89,"context_line":"  update_foo can be better expressed using a single query which avoids"}],"source_content_type":"text/x-python","patch_set":3,"id":"AAAALn%2F%2F5rU%3D","line":86,"in_reply_to":"AAAALn%2F%2F5yE%3D","updated":"2012-10-29 19:55:28.000000000","message":"Gah, yes. Too many edits before I posted it :)","commit_id":"fb17f1c48d6bbf933d7bc2230fefaa44fd1dccc0"},{"author":{"_account_id":67,"name":"Vish Ishaya","email":"vishvananda@gmail.com","username":"vishvananda"},"change_message_id":"1900b1be2be266363e1075d02b65c5a715f18653","unresolved":false,"context_lines":[{"line_number":86,"context_line":"  Note: update_foo is a trivially simple example of using \"with session.begin\"."},{"line_number":87,"context_line":"  Whereas create_many_foo is a good example of when a transaction is needed,"},{"line_number":88,"context_line":"  it is always best to use as few queries as possible. The two queries in"},{"line_number":89,"context_line":"  update_foo can be better expressed using a single query which avoids"},{"line_number":90,"context_line":"  the need for an explicit transaction. It can be expressed like so:"},{"line_number":91,"context_line":""},{"line_number":92,"context_line":"    def update_bar(context, foo_id, newbar):"}],"source_content_type":"text/x-python","patch_set":3,"id":"AAAALn%2F%2F5xs%3D","line":89,"updated":"2012-10-29 19:00:24.000000000","message":"ditto","commit_id":"fb17f1c48d6bbf933d7bc2230fefaa44fd1dccc0"},{"author":{"_account_id":67,"name":"Vish Ishaya","email":"vishvananda@gmail.com","username":"vishvananda"},"change_message_id":"1900b1be2be266363e1075d02b65c5a715f18653","unresolved":false,"context_lines":[{"line_number":101,"context_line":"  For reference, this emits approximagely the following SQL statement:"},{"line_number":102,"context_line":""},{"line_number":103,"context_line":"    UPDATE bar SET bar \u003d ${newbar}"},{"line_number":104,"context_line":"        WHERE id\u003d(SELECT bar_id FROM foo WHERE id \u003d ${foo_id} LIMIT 1);"},{"line_number":105,"context_line":""},{"line_number":106,"context_line":"* Passing an active session between methods. Sessions should only be passed"},{"line_number":107,"context_line":"  to private methods. The private method must use a subtransaction; otherwise"}],"source_content_type":"text/x-python","patch_set":3,"id":"AAAALn%2F%2F5xo%3D","line":104,"updated":"2012-10-29 19:00:24.000000000","message":"does this work in sqlite and postgres? Maybe we should loop in dprince, I remember something not working. Can\u0027t remember if it was subq or not.","commit_id":"fb17f1c48d6bbf933d7bc2230fefaa44fd1dccc0"},{"author":{"_account_id":2889,"name":"Aeva Black","email":"aeva.online@gmail.com","username":"tenbrae"},"change_message_id":"a6d5f00241771ea5e9a0aa09118be276cdd2f579","unresolved":false,"context_lines":[{"line_number":101,"context_line":"  For reference, this emits approximagely the following SQL statement:"},{"line_number":102,"context_line":""},{"line_number":103,"context_line":"    UPDATE bar SET bar \u003d ${newbar}"},{"line_number":104,"context_line":"        WHERE id\u003d(SELECT bar_id FROM foo WHERE id \u003d ${foo_id} LIMIT 1);"},{"line_number":105,"context_line":""},{"line_number":106,"context_line":"* Passing an active session between methods. Sessions should only be passed"},{"line_number":107,"context_line":"  to private methods. The private method must use a subtransaction; otherwise"}],"source_content_type":"text/x-python","patch_set":3,"id":"AAAALn%2F%2F5rY%3D","line":104,"in_reply_to":"AAAALn%2F%2F5xo%3D","updated":"2012-10-29 19:55:28.000000000","message":"I think you\u0027re thinking of update using a join. This mostly doesn\u0027t work outside of MySQL (and I\u0027m not sure if SA even supports that). AFAIK, update with subquery is fine, though I see you added dprince already, thanks.","commit_id":"fb17f1c48d6bbf933d7bc2230fefaa44fd1dccc0"}]}
