{"action":"created","issue":{"url":"https://api.github.com/repos/cockroachdb/cockroachdb-python/issues/25","repository_url":"https://api.github.com/repos/cockroachdb/cockroachdb-python","labels_url":"https://api.github.com/repos/cockroachdb/cockroachdb-python/issues/25/labels{/name}","comments_url":"https://api.github.com/repos/cockroachdb/cockroachdb-python/issues/25/comments","events_url":"https://api.github.com/repos/cockroachdb/cockroachdb-python/issues/25/events","html_url":"https://github.com/cockroachdb/cockroachdb-python/issues/25","id":232002863,"node_id":"MDU6SXNzdWUyMzIwMDI4NjM=","number":25,"title":"allow commit() within run_transaction() callback","user":{"login":"gpaul","id":442,"node_id":"MDQ6VXNlcjQ0Mg==","avatar_url":"https://avatars1.githubusercontent.com/u/442?v=4","gravatar_id":"","url":"https://api.github.com/users/gpaul","html_url":"https://github.com/gpaul","followers_url":"https://api.github.com/users/gpaul/followers","following_url":"https://api.github.com/users/gpaul/following{/other_user}","gists_url":"https://api.github.com/users/gpaul/gists{/gist_id}","starred_url":"https://api.github.com/users/gpaul/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gpaul/subscriptions","organizations_url":"https://api.github.com/users/gpaul/orgs","repos_url":"https://api.github.com/users/gpaul/repos","events_url":"https://api.github.com/users/gpaul/events{/privacy}","received_events_url":"https://api.github.com/users/gpaul/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":11,"created_at":"2017-05-29T11:55:48Z","updated_at":"2018-06-05T07:12:24Z","closed_at":null,"author_association":"NONE","body":"Running the following yields `psycopg2.InternalError: SAVEPOINT not supported except for COCKROACH_RESTART`\r\n\r\nI believe this is due to https://github.com/cockroachdb/cockroachdb-python/blob/master/cockroachdb/sqlalchemy/transaction.py#L54.\r\n\r\nWhy do we need `savepoint_state.cockroach_restart`? Considering that CockroachDB supports no other savepoint name, why not hard-code it and drop the conditional in the following functions:\r\nhttps://github.com/cockroachdb/cockroachdb-python/blob/master/cockroachdb/sqlalchemy/dialect.py#L158 \r\n\r\nSteps to reproduce:\r\n```\r\ndocker run -p 26257:26257 cockroachdb/cockroach:v1.0 start --insecure\r\n```\r\nThen run the following code:\r\nhttps://gist.github.com/gpaul/648189354975992a2c285143d08be88a\r\n\r\nThis gives the following output using `cockroachdb-python v0.1`:\r\nhttps://gist.github.com/gpaul/14fa2967c42d4ccf6b223322a7967476"},"comment":{"url":"https://api.github.com/repos/cockroachdb/cockroachdb-python/issues/comments/394605584","html_url":"https://github.com/cockroachdb/cockroachdb-python/issues/25#issuecomment-394605584","issue_url":"https://api.github.com/repos/cockroachdb/cockroachdb-python/issues/25","id":394605584,"node_id":"MDEyOklzc3VlQ29tbWVudDM5NDYwNTU4NA==","user":{"login":"rilweic","id":9164714,"node_id":"MDQ6VXNlcjkxNjQ3MTQ=","avatar_url":"https://avatars3.githubusercontent.com/u/9164714?v=4","gravatar_id":"","url":"https://api.github.com/users/rilweic","html_url":"https://github.com/rilweic","followers_url":"https://api.github.com/users/rilweic/followers","following_url":"https://api.github.com/users/rilweic/following{/other_user}","gists_url":"https://api.github.com/users/rilweic/gists{/gist_id}","starred_url":"https://api.github.com/users/rilweic/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rilweic/subscriptions","organizations_url":"https://api.github.com/users/rilweic/orgs","repos_url":"https://api.github.com/users/rilweic/repos","events_url":"https://api.github.com/users/rilweic/events{/privacy}","received_events_url":"https://api.github.com/users/rilweic/received_events","type":"User","site_admin":false},"created_at":"2018-06-05T07:12:24Z","updated_at":"2018-06-05T07:12:24Z","author_association":"NONE","body":"I am using Django with cockroachDB,while execute command  `python manage.py migrate`.It shows the error below.\r\n\r\n```\r\nTraceback (most recent call last):\r\n  File \"manage.py\", line 10, in <module>\r\n    execute_from_command_line(sys.argv)\r\n  File \"/app/.heroku/python/lib/python2.7/site-packages/django/core/management/__init__.py\", line 338, in execute_from_command_line\r\n    utility.execute()\r\n  File \"/app/.heroku/python/lib/python2.7/site-packages/django/core/management/__init__.py\", line 330, in execute\r\n    self.fetch_command(subcommand).run_from_argv(self.argv)\r\n  File \"/app/.heroku/python/lib/python2.7/site-packages/django/core/management/base.py\", line 390, in run_from_argv\r\n    self.execute(*args, **cmd_options)\r\n  File \"/app/.heroku/python/lib/python2.7/site-packages/django/core/management/base.py\", line 441, in execute\r\n    output = self.handle(*args, **options)\r\n  File \"/app/.heroku/python/lib/python2.7/site-packages/django/core/management/commands/migrate.py\", line 179, in handle\r\n    created_models = self.sync_apps(connection, executor.loader.unmigrated_apps)\r\n  File \"/app/.heroku/python/lib/python2.7/site-packages/django/core/management/commands/migrate.py\", line 306, in sync_apps\r\n    with connection.schema_editor() as editor:\r\n  File \"/app/.heroku/python/lib/python2.7/site-packages/django/db/backends/base/schema.py\", line 81, in __enter__\r\n    self.atomic.__enter__()\r\n  File \"/app/.heroku/python/lib/python2.7/site-packages/django/db/transaction.py\", line 178, in __enter__\r\n    sid = connection.savepoint()\r\n  File \"/app/.heroku/python/lib/python2.7/site-packages/django/db/backends/base/base.py\", line 242, in savepoint\r\n    self._savepoint(sid)\r\n  File \"/app/.heroku/python/lib/python2.7/site-packages/django/db/backends/base/base.py\", line 210, in _savepoint\r\n    cursor.execute(self.ops.savepoint_create_sql(sid))\r\n  File \"/app/.heroku/python/lib/python2.7/site-packages/django/db/backends/utils.py\", line 79, in execute\r\n    return super(CursorDebugWrapper, self).execute(sql, params)\r\n  File \"/app/.heroku/python/lib/python2.7/site-packages/django/db/backends/utils.py\", line 64, in execute\r\n    return self.cursor.execute(sql, params)\r\n  File \"/app/.heroku/python/lib/python2.7/site-packages/django/db/utils.py\", line 97, in __exit__\r\n    six.reraise(dj_exc_type, dj_exc_value, traceback)\r\n  File \"/app/.heroku/python/lib/python2.7/site-packages/django/db/backends/utils.py\", line 62, in execute\r\n    return self.cursor.execute(sql)\r\ndjango.db.utils.NotSupportedError: SAVEPOINT not supported except for COCKROACH_RESTART\r\n```"}}
{"actor":{"display_login":"rilweic"}}