{"action":"created","issue":{"url":"https://api.github.com/repos/LocusEnergy/sqlalchemy-vertica-python/issues/30","repository_url":"https://api.github.com/repos/LocusEnergy/sqlalchemy-vertica-python","labels_url":"https://api.github.com/repos/LocusEnergy/sqlalchemy-vertica-python/issues/30/labels{/name}","comments_url":"https://api.github.com/repos/LocusEnergy/sqlalchemy-vertica-python/issues/30/comments","events_url":"https://api.github.com/repos/LocusEnergy/sqlalchemy-vertica-python/issues/30/events","html_url":"https://github.com/LocusEnergy/sqlalchemy-vertica-python/issues/30","id":395330009,"node_id":"MDU6SXNzdWUzOTUzMzAwMDk=","number":30,"title":"UPDATE Support","user":{"login":"jordiyeh","id":5520251,"node_id":"MDQ6VXNlcjU1MjAyNTE=","avatar_url":"https://avatars1.githubusercontent.com/u/5520251?v=4","gravatar_id":"","url":"https://api.github.com/users/jordiyeh","html_url":"https://github.com/jordiyeh","followers_url":"https://api.github.com/users/jordiyeh/followers","following_url":"https://api.github.com/users/jordiyeh/following{/other_user}","gists_url":"https://api.github.com/users/jordiyeh/gists{/gist_id}","starred_url":"https://api.github.com/users/jordiyeh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jordiyeh/subscriptions","organizations_url":"https://api.github.com/users/jordiyeh/orgs","repos_url":"https://api.github.com/users/jordiyeh/repos","events_url":"https://api.github.com/users/jordiyeh/events{/privacy}","received_events_url":"https://api.github.com/users/jordiyeh/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2019-01-02T18:02:54Z","updated_at":"2019-01-02T19:46:00Z","closed_at":null,"author_association":"NONE","body":"Following the Object Relational Tutorial https://docs.sqlalchemy.org/en/rel_1_2/orm/tutorial.html\r\n\r\nThere seems to be an issue with the UPDATE statement return row count. The update SQL syntax is correct.\r\n\r\n>>> ed_user.password = 'asdf'\r\n>>> session.dirty\r\nIdentitySet([<User(name='ed', fullname='Ed Jones', password='asdf')>])\r\n>>> session.commit()\r\n2019-01-02 12:14:05,058 INFO sqlalchemy.engine.base.Engine UPDATE \"user\" SET password=:password WHERE \"user\".id = :user_id\r\n2019-01-02 12:14:05,058 INFO sqlalchemy.engine.base.Engine {'password': 'asdf', 'user_id': 500001}\r\n2019-01-02 12:14:05,123 INFO sqlalchemy.engine.base.Engine ROLLBACK\r\nTraceback (most recent call last):\r\n  File \"<stdin>\", line 1, in <module>\r\n  File \"/pyvirtualenv/rest_test/lib/python3.6/site-packages/sqlalchemy/orm/session.py\", line 954, in commit\r\n    self.transaction.commit()\r\n  File \"/pyvirtualenv/rest_test/lib/python3.6/site-packages/sqlalchemy/orm/session.py\", line 467, in commit\r\n    self._prepare_impl()\r\n  File \"/pyvirtualenv/rest_test/lib/python3.6/site-packages/sqlalchemy/orm/session.py\", line 447, in _prepare_impl\r\n    self.session.flush()\r\n  File \"/pyvirtualenv/rest_test/lib/python3.6/site-packages/sqlalchemy/orm/session.py\", line 2313, in flush\r\n    self._flush(objects)\r\n  File \"/pyvirtualenv/rest_test/lib/python3.6/site-packages/sqlalchemy/orm/session.py\", line 2440, in _flush\r\n    transaction.rollback(_capture_exception=True)\r\n  File \"/pyvirtualenv/rest_test/lib/python3.6/site-packages/sqlalchemy/util/langhelpers.py\", line 66, in __exit__\r\n    compat.reraise(exc_type, exc_value, exc_tb)\r\n  File \"/pyvirtualenv/rest_test/lib/python3.6/site-packages/sqlalchemy/util/compat.py\", line 249, in reraise\r\n    raise value\r\n  File \"/pyvirtualenv/rest_test/lib/python3.6/site-packages/sqlalchemy/orm/session.py\", line 2404, in _flush\r\n    flush_context.execute()\r\n  File \"/pyvirtualenv/rest_test/lib/python3.6/site-packages/sqlalchemy/orm/unitofwork.py\", line 395, in execute\r\n    rec.execute(self)\r\n  File \"/pyvirtualenv/rest_test/lib/python3.6/site-packages/sqlalchemy/orm/unitofwork.py\", line 560, in execute\r\n    uow\r\n  File \"/pyvirtualenv/rest_test/lib/python3.6/site-packages/sqlalchemy/orm/persistence.py\", line 177, in save_obj\r\n    mapper, table, update)\r\n  File \"/pyvirtualenv/rest_test/lib/python3.6/site-packages/sqlalchemy/orm/persistence.py\", line 797, in _emit_update_statements\r\n    (table.description, len(records), rows))\r\nsqlalchemy.orm.exc.StaleDataError: UPDATE statement on table 'user' expected to update 1 row(s); -1 were matched.\r\n\r\nI am trying to figure out how to fix and I would appreciate any guidance.\r\n\r\nThe following is working great.\r\nQuerying\r\nRollback\r\nCommon Filter Operators\r\nReturning Lists and Scalars\r\nUsing Textual SQL\r\nCounting\r\nDeleting"},"comment":{"url":"https://api.github.com/repos/LocusEnergy/sqlalchemy-vertica-python/issues/comments/450964749","html_url":"https://github.com/LocusEnergy/sqlalchemy-vertica-python/issues/30#issuecomment-450964749","issue_url":"https://api.github.com/repos/LocusEnergy/sqlalchemy-vertica-python/issues/30","id":450964749,"node_id":"MDEyOklzc3VlQ29tbWVudDQ1MDk2NDc0OQ==","user":{"login":"jordiyeh","id":5520251,"node_id":"MDQ6VXNlcjU1MjAyNTE=","avatar_url":"https://avatars1.githubusercontent.com/u/5520251?v=4","gravatar_id":"","url":"https://api.github.com/users/jordiyeh","html_url":"https://github.com/jordiyeh","followers_url":"https://api.github.com/users/jordiyeh/followers","following_url":"https://api.github.com/users/jordiyeh/following{/other_user}","gists_url":"https://api.github.com/users/jordiyeh/gists{/gist_id}","starred_url":"https://api.github.com/users/jordiyeh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jordiyeh/subscriptions","organizations_url":"https://api.github.com/users/jordiyeh/orgs","repos_url":"https://api.github.com/users/jordiyeh/repos","events_url":"https://api.github.com/users/jordiyeh/events{/privacy}","received_events_url":"https://api.github.com/users/jordiyeh/received_events","type":"User","site_admin":false},"created_at":"2019-01-02T19:46:00Z","updated_at":"2019-01-02T19:46:00Z","author_association":"NONE","body":"The following pull requests allowed me to use the UPDATE without errors\r\n\r\nhttps://github.com/LocusEnergy/sqlalchemy-vertica-python/pull/31\r\n\r\nThanks for pointing the rowcount oddity with vertica-python"}}
{"actor":{"display_login":"jordiyeh"}}