{ "info": { "author": "LOGILAB S.A. (Paris, FRANCE)", "author_email": "contact@logilab.fr", "bugtrack_url": null, "classifiers": [ "Environment :: Web Environment", "Framework :: CubicWeb", "Programming Language :: JavaScript", "Programming Language :: Python" ], "description": "Summary\n-------\n\nAdd a new attribue type to CubicWeb: ``Jsonb``. This type is mapped to the\n`jsonb PostgreSQL data type`_.\n\nDeclaration\n~~~~~~~~~~~\n\nIn your schemas, you can use the new type as follow::\n\n >>> class MyEntityType(EntityType):\n ... json_attribute = Jsonb(required=True)\n ...\n\nGet/Set\n~~~~~~~\n\nTo provide a value for a Jsonb attribute, you can use either:\n\n* a dict,\n* a JSON string.\n\nFor example, you can write the following code::\n\n >>> my_entity.cw_set(json_attribute={'a': [1, 2, 3]})\n\nThe code below wil have exactly the same effect::\n\n >>> my_entity.cw_set(json_attribute=u'{\"a\": [1, 2, 3]}')\n\nPlease note that, whatever way you set the value (string or dict), you will\nalways get back a dict when asking for it::\n\n >>> my_entity.json_attribute\n {u'a': [1, 2, 3]}\n\n\nQuerying\n~~~~~~~~\n\nIn RQL, you can query a Jsonb attribute in multiple ways. For example, you can\nask for attributes containing a specific key/value pair::\n\n >>> import json\n >>> rql('Any X WHERE X json_attribute J HAVING JSONB_CONTAINS(J, %(json_value)s)=True',\n {'json_value': json.dumps({u'a': 1})})\n\nYou can ask for existence of a specific key::\n\n >>> rql('Any X WHERE X json_attribute J HAVING JSONB_EXISTS(J, %(key)s)=True',\n {'key': u'b'})\n\nYou can get the value for a key::\n\n >>> rql('Any JSONB_GET(J, %(key)s) WHERE X json_attribute J, X eid %(eid)s',\n {'key': u'a', 'eid': 1234})\n\nNote: ``JSONB_GET()`` will *always* return a string. If the value is a JSON\nobject (or a JSON array), you may want to use ``json.loads()`` afterwards to\nhave a dict (or a list).\n\nOne final remark: as the PostgreSQL documentation suggests, you should use the\nsame structure for your JSON data in the same column. This makes querying much\neasier.\n\n.. _jsonb PostgreSQL data type: https://www.postgresql.org/docs/9.4/static/datatype-json.html", "description_content_type": null, "docs_url": null, "download_url": "UNKNOWN", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "http://www.cubicweb.org/project/cubicweb-jsonb", "keywords": null, "license": "LGPL", "maintainer": null, "maintainer_email": null, "name": "cubicweb-jsonb", "package_url": "https://pypi.org/project/cubicweb-jsonb/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/cubicweb-jsonb/", "project_urls": { "Download": "UNKNOWN", "Homepage": "http://www.cubicweb.org/project/cubicweb-jsonb" }, "release_url": "https://pypi.org/project/cubicweb-jsonb/0.1.0/", "requires_dist": null, "requires_python": null, "summary": "Add jsonb type to CubicWeb", "version": "0.1.0" }, "last_serial": 2481194, "releases": { "0.1.0": [ { "comment_text": "", "digests": { "md5": "ffef1fe52936b9fed72ec08d8373ffc8", "sha256": "02f400f14faa2d4c9d25008bf702370190e772811a83a052a9c7d10c6a6a5861" }, "downloads": -1, "filename": "cubicweb-jsonb-0.1.0.tar.gz", "has_sig": false, "md5_digest": "ffef1fe52936b9fed72ec08d8373ffc8", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 8957, "upload_time": "2016-11-24T17:07:54", "url": "https://files.pythonhosted.org/packages/39/65/71e4ee0e7383d23d445ba720668e5797bd036af794930548c0440de457c2/cubicweb-jsonb-0.1.0.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "ffef1fe52936b9fed72ec08d8373ffc8", "sha256": "02f400f14faa2d4c9d25008bf702370190e772811a83a052a9c7d10c6a6a5861" }, "downloads": -1, "filename": "cubicweb-jsonb-0.1.0.tar.gz", "has_sig": false, "md5_digest": "ffef1fe52936b9fed72ec08d8373ffc8", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 8957, "upload_time": "2016-11-24T17:07:54", "url": "https://files.pythonhosted.org/packages/39/65/71e4ee0e7383d23d445ba720668e5797bd036af794930548c0440de457c2/cubicweb-jsonb-0.1.0.tar.gz" } ] }