{"action":"created","issue":{"url":"https://api.github.com/repos/cockroachdb/cockroachdb-python/issues/51","repository_url":"https://api.github.com/repos/cockroachdb/cockroachdb-python","labels_url":"https://api.github.com/repos/cockroachdb/cockroachdb-python/issues/51/labels{/name}","comments_url":"https://api.github.com/repos/cockroachdb/cockroachdb-python/issues/51/comments","events_url":"https://api.github.com/repos/cockroachdb/cockroachdb-python/issues/51/events","html_url":"https://github.com/cockroachdb/cockroachdb-python/issues/51","id":319141417,"number":51,"title":"Cockroachdb sqlalchemy dialect doesn't fully support JSONB","user":{"login":"desprit","id":4673543,"avatar_url":"https://avatars1.githubusercontent.com/u/4673543?v=4","gravatar_id":"","url":"https://api.github.com/users/desprit","html_url":"https://github.com/desprit","followers_url":"https://api.github.com/users/desprit/followers","following_url":"https://api.github.com/users/desprit/following{/other_user}","gists_url":"https://api.github.com/users/desprit/gists{/gist_id}","starred_url":"https://api.github.com/users/desprit/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/desprit/subscriptions","organizations_url":"https://api.github.com/users/desprit/orgs","repos_url":"https://api.github.com/users/desprit/repos","events_url":"https://api.github.com/users/desprit/events{/privacy}","received_events_url":"https://api.github.com/users/desprit/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":{"login":"justinj","id":409075,"avatar_url":"https://avatars2.githubusercontent.com/u/409075?v=4","gravatar_id":"","url":"https://api.github.com/users/justinj","html_url":"https://github.com/justinj","followers_url":"https://api.github.com/users/justinj/followers","following_url":"https://api.github.com/users/justinj/following{/other_user}","gists_url":"https://api.github.com/users/justinj/gists{/gist_id}","starred_url":"https://api.github.com/users/justinj/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/justinj/subscriptions","organizations_url":"https://api.github.com/users/justinj/orgs","repos_url":"https://api.github.com/users/justinj/repos","events_url":"https://api.github.com/users/justinj/events{/privacy}","received_events_url":"https://api.github.com/users/justinj/received_events","type":"User","site_admin":false},"assignees":[{"login":"justinj","id":409075,"avatar_url":"https://avatars2.githubusercontent.com/u/409075?v=4","gravatar_id":"","url":"https://api.github.com/users/justinj","html_url":"https://github.com/justinj","followers_url":"https://api.github.com/users/justinj/followers","following_url":"https://api.github.com/users/justinj/following{/other_user}","gists_url":"https://api.github.com/users/justinj/gists{/gist_id}","starred_url":"https://api.github.com/users/justinj/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/justinj/subscriptions","organizations_url":"https://api.github.com/users/justinj/orgs","repos_url":"https://api.github.com/users/justinj/repos","events_url":"https://api.github.com/users/justinj/events{/privacy}","received_events_url":"https://api.github.com/users/justinj/received_events","type":"User","site_admin":false}],"milestone":null,"comments":14,"created_at":"2018-05-01T08:04:48Z","updated_at":"2018-05-08T22:00:50Z","closed_at":null,"author_association":"NONE","body":"I'm testing recently added JSONB.\r\n\r\nSetup:\r\n```\r\npython3.6\r\npsycopg2==2.7.4\r\nSQLAlchemy==1.2.5\r\ncockroachdb v2.0.1\r\n```\r\n\r\nI was able to save a sample data into the database. This is how it looks in a dump file:\r\n```\r\n{\r\n    \"id\" : \"2a4b4578-1a5d-455b-9317-c90c5f3afe15\",\r\n    \"enabled\" : true,\r\n    \"language\" : \"en-us\",\r\n    \"ui_metadata\" : \"{\\\"origin\\\": \\\"111\\\", \\\"ui\\\": null, \\\"version\\\": null}\",\r\n}\r\n```\r\nI'm now loading data with sqlalchemy session.query.all()\r\nError:\r\n```\r\n    return json_deserializer(value)\r\n  File \"/usr/local/lib/python3.6/json/__init__.py\", line 348, in loads\r\n    'not {!r}'.format(s.__class__.__name__))\r\nTypeError: the JSON object must be str, bytes or bytearray, not 'dict'\r\n```\r\nhttps://bitbucket.org/zzzeek/sqlalchemy/src/7541d9b258e4d0c115d6160592ac7e17f8fd50cc/lib/sqlalchemy/sql/sqltypes.py?at=master&fileviewer=file-view-default#sqltypes.py-2145:2155\r\nhttps://github.com/cockroachdb/cockroachdb-python/blob/master/cockroachdb/sqlalchemy/dialect.py\r\n\r\nThis line fails:\r\n```\r\njson_deserializer = dialect._json_deserializer or json.loads\r\n```\r\nBecause there is no `_json_deserializer` and it tries to call json.loads on a python dict."},"comment":{"url":"https://api.github.com/repos/cockroachdb/cockroachdb-python/issues/comments/387556186","html_url":"https://github.com/cockroachdb/cockroachdb-python/issues/51#issuecomment-387556186","issue_url":"https://api.github.com/repos/cockroachdb/cockroachdb-python/issues/51","id":387556186,"user":{"login":"bdarnell","id":160562,"avatar_url":"https://avatars1.githubusercontent.com/u/160562?v=4","gravatar_id":"","url":"https://api.github.com/users/bdarnell","html_url":"https://github.com/bdarnell","followers_url":"https://api.github.com/users/bdarnell/followers","following_url":"https://api.github.com/users/bdarnell/following{/other_user}","gists_url":"https://api.github.com/users/bdarnell/gists{/gist_id}","starred_url":"https://api.github.com/users/bdarnell/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bdarnell/subscriptions","organizations_url":"https://api.github.com/users/bdarnell/orgs","repos_url":"https://api.github.com/users/bdarnell/repos","events_url":"https://api.github.com/users/bdarnell/events{/privacy}","received_events_url":"https://api.github.com/users/bdarnell/received_events","type":"User","site_admin":false},"created_at":"2018-05-08T22:00:50Z","updated_at":"2018-05-08T22:00:50Z","author_association":"OWNER","body":"I've posted a fix in #53. We still have some test failures when running with SQLAlchemy 1.2 so we'll continue to test with 1.1 for now (#54), but I have confirmed that #53 makes JSON work with 1.2 (and the remaining test failures look like obscure reflection issues, so I don't see any reason for you to downgrade to 1.1). "}}
{"actor":{"display_login":"bdarnell"}}