{ "info": { "author": "Cristiano Cortezia", "author_email": "cristiano.cortezia@gmail.com", "bugtrack_url": null, "classifiers": [ "License :: OSI Approved :: MIT License", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.7" ], "description": "[![CircleCI](https://circleci.com/gh/ccortezia/voxsql/tree/master.svg?style=svg)](https://circleci.com/gh/ccortezia/voxsql/tree/master) [![Maintainability](https://api.codeclimate.com/v1/badges/e923a96d98200af83af6/maintainability)](https://codeclimate.com/github/ccortezia/voxsql/maintainability) [![Test Coverage](https://api.codeclimate.com/v1/badges/e923a96d98200af83af6/test_coverage)](https://codeclimate.com/github/ccortezia/voxsql/test_coverage)\n\n# voxsql\n\nGenerates application artifacts from documented SQL code.\n\n\n## Use Cases\n\nUse cases for this library include but are not limited to:\n* Automatic generation of human-friendly documentation of SQL excerpts.\n* Automatic generation of application-level bindings ([Learn more](docs/code-gen.md)).\n* Instrumentation of test code to extend coverage analysis to SQL excerpts.\n\n## Getting Started\n\n```\npip install voxsql\n```\n\n## Basic Concepts\n\n`voxsql` works on annotated SQL files. Annotations are provided as Javadoc-like comments, and only properly framed SQL segments are considered by the library when parsing files. Below is an example:\n\n```sql\n/**\n * Adds a contact to the database.\n *\n * @dialect postgresql\n * @name add_contact\n * @param contact_name: string - the target contact's name\n * @retmode record\n * @retval name: string\n */\n{\n insert into contacts (name)\n values (%(contact_name)s)\n returning name\n ;\n}\n```\n\n_Save the snippet above to `sample.sql` to run the examples below._\n\n## CLI Usage\n\nTo digest the SQL file above using the CLI:\n\n```shell\nvoxsql sample.sql\n```\n\nFor more information run `voxsql --help`.\n\n## Direct Library Usage\n\nBelow is an example on how you can manipulate the file above using the Python library directly:\n\n```python\nfrom voxsql import parse\nframes = parse(open('sample.sql').read())\nassert frames[0].header.name == 'add_contact'\nassert frames[0].body.source.startswith('insert into contacts')\n```\n\n## Design Goals and Inspiration\n\n`voxsql` strives to promote SQL as a first-class language within application-centric projects.\n\nAs opposed to ORMs, `voxsql` does not try to encapsulate SQL within higher-level application-level abstractions, nor does it try to rewrite or adapt provided SQL for greater portability. The premise here is that directly writing and maintaing SQL code has some interesting advantages, such as a lower barrier to the usage of more advanced SQL features, easier inspection of queries, and the possibility to reduce application footprint and complexity. It is a fair statement to assume `voxsql` promotes simplicity at the cost of flexibility.\n\nSome of the typically recognized drawbacks of a SQL-heavy design, like the lack of query composability, the difficulty to promote code reuse, and the lack of cross-engine portability are not `voxsql`'s focus, and for that reason, it is considered unsuitable for projects that really need to support an unpredictably complex persistence layer, which might not be as representative of current reality as common sense assumes to be the case these days.\n\nHere are a few projects that promote SQL for application development in slightly different ways:\n* [`HugSQL`](https://github.com/layerware/hugsql): DSL-based SQL-bindings generation for Clojure\n* [`Yesql`](https://github.com/krisajenkins/yesql/): DSL-based SQL-bindings generation for Clojure\n* [`anosql`](https://github.com/honza/anosql): inspired by `Yesql`, for Python.\n\nListed below are references to material that positively influenced ideas contained in `voxsql`:\n* _[Mastering PostgreSQL In Application Development](https://masteringpostgresql.com/), by Dimitri Fontaine_.\n\n## Contributing\n\nThis is how you run tests locally:\n\n```shell\nmake test.start.d\npytest\n```\n\n## Roadmap\n\n* Automate exception handling by means of a new `@error` tag.\n* Add support to `@dialect sqlite`\n* Add support to `@dialect mysql`\n* Add support to `@dialect xyz:version`\n* Add sphinx docs\n* Add cli command for lanching the interpreter with bindings preloaded.\n\n\n", "description_content_type": "text/markdown", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/ccortezia/voxsql/", "keywords": "", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "voxsql", "package_url": "https://pypi.org/project/voxsql/", "platform": "", "project_url": "https://pypi.org/project/voxsql/", "project_urls": { "Homepage": "https://github.com/ccortezia/voxsql/" }, "release_url": "https://pypi.org/project/voxsql/0.1.1/", "requires_dist": [ "Click" ], "requires_python": "", "summary": "Generate application artifacts from documented SQL code", "version": "0.1.1" }, "last_serial": 5347701, "releases": { "0.1.0": [ { "comment_text": "", "digests": { "md5": "58ca342b2a7ee093f9df7de3fd76b32c", "sha256": "6d4ec1cb5408583386fa7a8ce4cdca090b00fbe43413a7a9ac298107d26f24a3" }, "downloads": -1, "filename": "voxsql-0.1.0-py3-none-any.whl", "has_sig": false, "md5_digest": "58ca342b2a7ee093f9df7de3fd76b32c", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 19699, "upload_time": "2019-06-02T01:39:30", "url": "https://files.pythonhosted.org/packages/e9/f0/e000980be4de0f959677965f2f95557ca4bbfaa5b46dbe25ccada150ea08/voxsql-0.1.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "1f85cfaaa3e6d2c49d13d852a816b0f2", "sha256": "6c4693a38fd378d4a18874bf7c072c88285d0310503b0e0ed3c61d9dc00d0f46" }, "downloads": -1, "filename": "voxsql-0.1.0.tar.gz", "has_sig": false, "md5_digest": "1f85cfaaa3e6d2c49d13d852a816b0f2", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6246, "upload_time": "2019-06-02T01:39:32", "url": "https://files.pythonhosted.org/packages/2d/32/071e1adc9a0a0be2b54c3d890c3bccac6bb32b39c43befd87e500e627d84/voxsql-0.1.0.tar.gz" } ], "0.1.1": [ { "comment_text": "", "digests": { "md5": "64a45e10dc3166b577c980f46529fedb", "sha256": "d7606dccc917e625e58cd600d02444d9db799bcede995516723347c3990b36ab" }, "downloads": -1, "filename": "voxsql-0.1.1-py3-none-any.whl", "has_sig": false, "md5_digest": "64a45e10dc3166b577c980f46529fedb", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 8827, "upload_time": "2019-06-02T02:11:12", "url": "https://files.pythonhosted.org/packages/80/ea/6536fecd5ea8a36b3bc0014cdd10fd70768109c30c2c140bd989084bec75/voxsql-0.1.1-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "48fd4dfd8215b02e7b34c71f256d1cd4", "sha256": "6d79e60336806a1c319d30c79fd02549e39b99449da2bd6d5e6cb741e75446c2" }, "downloads": -1, "filename": "voxsql-0.1.1.tar.gz", "has_sig": false, "md5_digest": "48fd4dfd8215b02e7b34c71f256d1cd4", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6400, "upload_time": "2019-06-02T02:11:14", "url": "https://files.pythonhosted.org/packages/74/a4/c08aa26734e88499887aa986f996b1d70e69e81759ee6ce9d6dcf2997a48/voxsql-0.1.1.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "64a45e10dc3166b577c980f46529fedb", "sha256": "d7606dccc917e625e58cd600d02444d9db799bcede995516723347c3990b36ab" }, "downloads": -1, "filename": "voxsql-0.1.1-py3-none-any.whl", "has_sig": false, "md5_digest": "64a45e10dc3166b577c980f46529fedb", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 8827, "upload_time": "2019-06-02T02:11:12", "url": "https://files.pythonhosted.org/packages/80/ea/6536fecd5ea8a36b3bc0014cdd10fd70768109c30c2c140bd989084bec75/voxsql-0.1.1-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "48fd4dfd8215b02e7b34c71f256d1cd4", "sha256": "6d79e60336806a1c319d30c79fd02549e39b99449da2bd6d5e6cb741e75446c2" }, "downloads": -1, "filename": "voxsql-0.1.1.tar.gz", "has_sig": false, "md5_digest": "48fd4dfd8215b02e7b34c71f256d1cd4", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6400, "upload_time": "2019-06-02T02:11:14", "url": "https://files.pythonhosted.org/packages/74/a4/c08aa26734e88499887aa986f996b1d70e69e81759ee6ce9d6dcf2997a48/voxsql-0.1.1.tar.gz" } ] }