sql-smith


Namesql-smith JSON
Version 1.0.0 PyPI version JSON
download
home_pagehttps://github.com/fbraem/sql-smith
Summarysql-smith is an SQL query builder with zero dependencies and a fluent interface.
upload_time2021-04-24 17:14:29
maintainer
docs_urlNone
authorFranky Braem
requires_python
licenseMIT
keywords sql-smith query builder querybuilder sql mysql sqlite postgres sqlserver database
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            =========
sql-smith
=========

**sql-smith** is an SQL query builder with zero dependencies and a fluent interface.

    The sentence above is, beside the name, a copy from the website of the PHP library
    Latitude_, for the simple reason that this Python module is a port of Latitude.

Installation
************

.. code-block:: sh

    $ pip install sql-smith

Quick Start
***********

QueryFactory is a factory to create a **SELECT**, **INSERT**, **UPDATE** or **DELETE** query.
Use the fluent interface of the queries to complete the query.

.. code-block:: python

    from sql_smith import QueryFactory
    from sql_smith.engine import CommonEngine
    from sql_smith.functions import field

    factory = QueryFactory(CommonEngine())
    query = factory \
        .select('id', 'username') \
        .from_('users') \
        .where(field('id').eq(5)) \
        .compile()

    print(query.sql)  # SELECT "id", "username" FROM "users" WHERE "id" = ?
    print(query.params)  # (5)

When the query is ready, compile it. The return value of compile is a Query class instance
with two properties: sql and params. Use these properties to pass the query to a database.

.. code-block:: python

    import sqlite3

    db = sqlite3.connect('test.db')
    cur = db.cursor()

    for row in cur.execute(query.sql, query.params):
        print(row)

.. _Latitude: https://latitude.shadowhand.com/



            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/fbraem/sql-smith",
    "name": "sql-smith",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "sql-smith query builder querybuilder sql mysql sqlite postgres sqlserver database",
    "author": "Franky Braem",
    "author_email": "franky.braem@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/bb/7f/46b1886acc75fc62c2e5d290619d5253762f9ac8b87c32800747b0e8efba/sql-smith-1.0.0.tar.gz",
    "platform": "",
    "description": "=========\nsql-smith\n=========\n\n**sql-smith** is an SQL query builder with zero dependencies and a fluent interface.\n\n    The sentence above is, beside the name, a copy from the website of the PHP library\n    Latitude_, for the simple reason that this Python module is a port of Latitude.\n\nInstallation\n************\n\n.. code-block:: sh\n\n    $ pip install sql-smith\n\nQuick Start\n***********\n\nQueryFactory is a factory to create a **SELECT**, **INSERT**, **UPDATE** or **DELETE** query.\nUse the fluent interface of the queries to complete the query.\n\n.. code-block:: python\n\n    from sql_smith import QueryFactory\n    from sql_smith.engine import CommonEngine\n    from sql_smith.functions import field\n\n    factory = QueryFactory(CommonEngine())\n    query = factory \\\n        .select('id', 'username') \\\n        .from_('users') \\\n        .where(field('id').eq(5)) \\\n        .compile()\n\n    print(query.sql)  # SELECT \"id\", \"username\" FROM \"users\" WHERE \"id\" = ?\n    print(query.params)  # (5)\n\nWhen the query is ready, compile it. The return value of compile is a Query class instance\nwith two properties: sql and params. Use these properties to pass the query to a database.\n\n.. code-block:: python\n\n    import sqlite3\n\n    db = sqlite3.connect('test.db')\n    cur = db.cursor()\n\n    for row in cur.execute(query.sql, query.params):\n        print(row)\n\n.. _Latitude: https://latitude.shadowhand.com/\n\n\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "sql-smith is an SQL query builder with zero dependencies and a fluent interface.",
    "version": "1.0.0",
    "split_keywords": [
        "sql-smith",
        "query",
        "builder",
        "querybuilder",
        "sql",
        "mysql",
        "sqlite",
        "postgres",
        "sqlserver",
        "database"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "md5": "9c16f29c82649d27e2f09d0e2daea347",
                "sha256": "e5a2ccadb3d5b990380a7054e56d1e1826b9bd89415fe486788befefb314c375"
            },
            "downloads": -1,
            "filename": "sql_smith-1.0.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "9c16f29c82649d27e2f09d0e2daea347",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 28794,
            "upload_time": "2021-04-24T17:14:27",
            "upload_time_iso_8601": "2021-04-24T17:14:27.966513Z",
            "url": "https://files.pythonhosted.org/packages/bf/7f/c7f0c5778974e6c8d50f394c743a52c3336c4f24426686af0b117b68b33d/sql_smith-1.0.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "md5": "0ac788d2b50eda883172769322217d0c",
                "sha256": "91c13702a2b75680bacc728b92ef08d181382d029355bfc7f2ed325033773bac"
            },
            "downloads": -1,
            "filename": "sql-smith-1.0.0.tar.gz",
            "has_sig": false,
            "md5_digest": "0ac788d2b50eda883172769322217d0c",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 14101,
            "upload_time": "2021-04-24T17:14:29",
            "upload_time_iso_8601": "2021-04-24T17:14:29.212109Z",
            "url": "https://files.pythonhosted.org/packages/bb/7f/46b1886acc75fc62c2e5d290619d5253762f9ac8b87c32800747b0e8efba/sql-smith-1.0.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2021-04-24 17:14:29",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "github_user": null,
    "github_project": "fbraem",
    "error": "Could not fetch GitHub repository",
    "lcname": "sql-smith"
}
        
Elapsed time: 0.27757s