{"action":"created","issue":{"url":"https://api.github.com/repos/mitsuhiko/flask-sqlalchemy/issues/256","labels_url":"https://api.github.com/repos/mitsuhiko/flask-sqlalchemy/issues/256/labels{/name}","comments_url":"https://api.github.com/repos/mitsuhiko/flask-sqlalchemy/issues/256/comments","events_url":"https://api.github.com/repos/mitsuhiko/flask-sqlalchemy/issues/256/events","html_url":"https://github.com/mitsuhiko/flask-sqlalchemy/pull/256","id":53985173,"number":256,"title":"Fix and deprecate change tracking","user":{"login":"davidism","id":1242887,"avatar_url":"https://avatars.githubusercontent.com/u/1242887?v=3","gravatar_id":"","url":"https://api.github.com/users/davidism","html_url":"https://github.com/davidism","followers_url":"https://api.github.com/users/davidism/followers","following_url":"https://api.github.com/users/davidism/following{/other_user}","gists_url":"https://api.github.com/users/davidism/gists{/gist_id}","starred_url":"https://api.github.com/users/davidism/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/davidism/subscriptions","organizations_url":"https://api.github.com/users/davidism/orgs","repos_url":"https://api.github.com/users/davidism/repos","events_url":"https://api.github.com/users/davidism/events{/privacy}","received_events_url":"https://api.github.com/users/davidism/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-01-11T07:54:12Z","updated_at":"2015-01-22T11:27:12Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/mitsuhiko/flask-sqlalchemy/pulls/256","html_url":"https://github.com/mitsuhiko/flask-sqlalchemy/pull/256","diff_url":"https://github.com/mitsuhiko/flask-sqlalchemy/pull/256.diff","patch_url":"https://github.com/mitsuhiko/flask-sqlalchemy/pull/256.patch"},"body":"Use `before_flush` event to track changes.  This removes the need for mapper events.  It also makes the `before_models_committed` event work, addressing #90, #95, #150, and #237.  Instances are identified using SQLAlchemy's `identity_key` if possible rather than just primary key, to guard against separate models with the same keys, addressing #78 and #156.\r\n\r\nOnly register modification tracking events if the configuration enables them.  Previously, the events would always be registered but wouldn't do anything.  This reduces the overhead of handling each callback when not needed.  The events are registered on specific sessions, not the top-level session, and registration creates the `_model_changes` property, so there is no need to guard against this not existing anymore.  This better addresses #89, #109, #135, #144, and #162.\r\n\r\nDiscussion in #150 concluded that the signals should be deprecated. The default config is changed to `None` to indicate \"not set\".  This enables the events and issues a warning that the events will be disabled by default in the future.  Explicitly setting the config to `True` silences the warning, as that will be the normal way to enable the events in the future.  Based on this, #117 should be closed since adding *more* signals doesn't make sense.\r\n\r\nThe test for `before_models_committed` (#236) was always failing because the variable in closure couln't be set.  This is fixed by using a namespace and setting an attribute there.  There is also an issue with the type of `changes` (#160), this is fixed by always returning a list (which matches the behavior of the other signal)."},"comment":{"url":"https://api.github.com/repos/mitsuhiko/flask-sqlalchemy/issues/comments/71006938","html_url":"https://github.com/mitsuhiko/flask-sqlalchemy/pull/256#issuecomment-71006938","issue_url":"https://api.github.com/repos/mitsuhiko/flask-sqlalchemy/issues/256","id":71006938,"user":{"login":"immunda","id":524365,"avatar_url":"https://avatars.githubusercontent.com/u/524365?v=3","gravatar_id":"","url":"https://api.github.com/users/immunda","html_url":"https://github.com/immunda","followers_url":"https://api.github.com/users/immunda/followers","following_url":"https://api.github.com/users/immunda/following{/other_user}","gists_url":"https://api.github.com/users/immunda/gists{/gist_id}","starred_url":"https://api.github.com/users/immunda/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/immunda/subscriptions","organizations_url":"https://api.github.com/users/immunda/orgs","repos_url":"https://api.github.com/users/immunda/repos","events_url":"https://api.github.com/users/immunda/events{/privacy}","received_events_url":"https://api.github.com/users/immunda/received_events","type":"User","site_admin":false},"created_at":"2015-01-22T11:27:12Z","updated_at":"2015-01-22T11:27:12Z","body":"@davidism We keep missing each other on IRC (-:\r\n\r\nKeen to have this in, but I think it might be worth slating for 3.0 as it's a bit more of a drastic change."}}