{
    "info": {
        "author": "BlueDynamics Alliance",
        "author_email": "dev@bluedynamics.com",
        "bugtrack_url": null,
        "classifiers": [
            "Environment :: Web Environment",
            "Programming Language :: Python",
            "Topic :: Internet :: WWW/HTTP :: Dynamic Content"
        ],
        "description": "cone.sql\n========\n\nThis package provides SQLAlchemy integration in ``cone.app`` and basic\napplication nodes for publishing SQLAlchemy models.\n\n\nInstallation\n------------\n\nInclude ``cone.sql`` to install dependencies in your application's\n``setup.py``.\n\n\nConfigure Database and WSGI\n---------------------------\n\nAdopt your application config ini file to define database location and hook\nup the related elements to the WSGI pipeline.\n\n.. code-block:: ini\n\n    [app:my_app]\n    use = egg:cone.app#main\n\n    cone.plugins =\n        cone.sql\n\n    cone.sql.dbinit.url = sqlite:///%(here)s/var/sqlite/my_db.db\n\n    [filter:remote_addr]\n    # for use behind nginx\n    use = egg:cone.app#remote_addr\n\n    [filter:tm]\n    use = egg:repoze.tm2#tm\n    commit_veto = repoze.tm:default_commit_veto\n\n    [filter:session]\n    use = egg:cone.sql#session\n    sqlalchemy.url = sqlite:///%(here)s/var/sqlite/my_db.db\n\n    [pipeline:main]\n    pipeline =\n        remote_addr\n        egg:repoze.retry#retry\n        tm\n        session\n        my_app\n\n\nCreate Model and Nodes\n----------------------\n\nDefine the SQLAlchemy model.\n\n.. code-block:: python\n\n    from cone.sql import SQLBase\n    from cone.sql.model import GUID\n    from sqlalchemy import Column\n    from sqlalchemy import String\n\n    class MyRecord(SQLBase):\n        __tablename__ = 'my_table'\n        uid_key = Column(GUID, primary_key=True)\n        field = Column(String)\n\nDefine an application node which represents the SQL row and uses the SQLAlchemy\nmodel. The class holds a reference to the related SQLAlchemy model.\n\n.. code-block:: python\n\n    from cone.sql.model import SQLRowNode\n\n    class MyNode(SQLRowNode):\n        record_class = MyRecord\n\nDefine an application node which represents the table and acts as container for\nthe SQL row nodes. The class holds a reference to the related SQLAlchemy model\nand the related SQLRowNode.\n\n.. code-block:: python\n\n    from cone.sql.model import SQLTableNode\n\n    class MyContainer(SQLTableNode):\n        record_class = MyRecord\n        child_factory = MyNode\n\n\nPrimary key handling\n--------------------\n\nThe node name maps to the primary key of the SQLAlchemy model (currenly no\nmultiple primary keys are supported). Node names are converted to the\nprimary key data type automatically. The conversion factories are defined at\n``SQLTableNode.data_type_converters`` which can be extended by more data types\nif needed.\n\n.. code-block:: python\n\n    >>> SQLTableNode.data_type_converters\n    {<class 'sqlalchemy.sql.sqltypes.String'>: <type 'unicode'>,\n    <class 'cone.sql.model.GUID'>: <class 'uuid.UUID'>,\n    <class 'sqlalchemy.sql.sqltypes.Integer'>: <type 'int'>}\n\n\nIntegrate to the Application Model\n----------------------------------\n\nIn order to publish a SQL table node, the table node must be hooked up to the\napplication model. To hook up the at root level, register it as entry.\n\n.. code-block:: python\n\n    import cone.app\n\n    cone.app.register_entry('container', MyContainer)\n\n\nSession setup handlers\n----------------------\n\nThere exists a ``sql_session_setup`` decorator which can be used to perform\nsession setup tasks like registering SQLAlchemy event listeners.\n\n.. code-block:: python\n\n    from cone.sql import sql_session_setup\n    from sqlalchemy import event\n\n    def after_flush(session, flush_context):\n        \"\"\"Do something after flush.\n        \"\"\"\n\n    @sql_session_setup\n    def bind_session_listener(session):\n        \"\"\"SQL session setup callback.\n        \"\"\"\n        event.listen(session, 'after_flush', after_flush)\n\n\nQuery the database\n------------------\n\nQuerying the database is done via SQLAlchemy. You can acquire the session from\nrequest via ``get_session`` and perform arbitrary operations on it.\n\n.. code-block:: python\n\n    from cone.sql import get_session\n\n    session = get_session(request)\n    result = session.query(MyRecord).all()\n\n\nTODO\n----\n\n- Support multiple primary keys.\n\n\nTest coverage\n-------------\n\nSummary of the test coverage report::\n\n    lines   cov%   module\n       50   100%   cone.sql.__init__\n      186    99%   cone.sql.model\n       57   100%   cone.sql.testing\n       18   100%   cone.sql.tests\n\n\nContributors\n============\n\n- Robert Niederreiter (Author)\n\nChanges\n=======\n\n0.1 (2017-03-28)\n----------------\n\n- Initial work.\n  [rnix, 2017-18-01]\n\nLicense\n=======\n\nCopyright (c) 2017, BlueDynamics Alliance, Austria\nAll rights reserved.\n\nRedistribution and use in source and binary forms, with or without\nmodification, are permitted provided that the following conditions are met:\n\n* Redistributions of source code must retain the above copyright notice, this\n  list of conditions and the following disclaimer.\n* Redistributions in binary form must reproduce the above copyright notice, this\n  list of conditions and the following disclaimer in the documentation and/or\n  other materials provided with the distribution.\n* Neither the name of the BlueDynamics Alliance nor the names of its\n  contributors may be used to endorse or promote products derived from this\n  software without specific prior written permission.\n\nTHIS SOFTWARE IS PROVIDED BY BlueDynamics Alliance ``AS IS`` AND ANY\nEXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\nWARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\nDISCLAIMED. IN NO EVENT SHALL BlueDynamics Alliance BE LIABLE FOR ANY\nDIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\n(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\nLOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND\nON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\nSOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.",
        "description_content_type": null,
        "docs_url": null,
        "download_url": "UNKNOWN",
        "downloads": {
            "last_day": -1,
            "last_month": -1,
            "last_week": -1
        },
        "home_page": "https://github.com/bluedynamics/cone.sql",
        "keywords": "node pyramid cone web",
        "license": "Simplified BSD",
        "maintainer": null,
        "maintainer_email": null,
        "name": "cone.sql",
        "package_url": "https://pypi.org/project/cone.sql/",
        "platform": "UNKNOWN",
        "project_url": "https://pypi.org/project/cone.sql/",
        "project_urls": {
            "Download": "UNKNOWN",
            "Homepage": "https://github.com/bluedynamics/cone.sql"
        },
        "release_url": "https://pypi.org/project/cone.sql/0.1/",
        "requires_dist": null,
        "requires_python": null,
        "summary": "SQLAlchemy integration for cone.app",
        "version": "0.1"
    },
    "last_serial": 2736580,
    "releases": {
        "0.1": [
            {
                "comment_text": "",
                "digests": {
                    "md5": "3d752ce4065e8866f2902193ccdc603e",
                    "sha256": "aa761b7bd92b6e9fc34f8cf0d43e9e6115c80caa94ad11df6237e1386865c363"
                },
                "downloads": -1,
                "filename": "cone.sql-0.1.tar.gz",
                "has_sig": false,
                "md5_digest": "3d752ce4065e8866f2902193ccdc603e",
                "packagetype": "sdist",
                "python_version": "source",
                "requires_python": null,
                "size": 13293,
                "upload_time": "2017-03-28T16:00:28",
                "url": "https://files.pythonhosted.org/packages/aa/4d/6fda4a39bc32d6476dffc2c584c19011907e50b678a0a477a447bd13b274/cone.sql-0.1.tar.gz"
            }
        ]
    },
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "md5": "3d752ce4065e8866f2902193ccdc603e",
                "sha256": "aa761b7bd92b6e9fc34f8cf0d43e9e6115c80caa94ad11df6237e1386865c363"
            },
            "downloads": -1,
            "filename": "cone.sql-0.1.tar.gz",
            "has_sig": false,
            "md5_digest": "3d752ce4065e8866f2902193ccdc603e",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 13293,
            "upload_time": "2017-03-28T16:00:28",
            "url": "https://files.pythonhosted.org/packages/aa/4d/6fda4a39bc32d6476dffc2c584c19011907e50b678a0a477a447bd13b274/cone.sql-0.1.tar.gz"
        }
    ]
}