{ "info": { "author": "Paul Glass", "author_email": "pnglass@gmail.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 2 - Pre-Alpha", "Environment :: Console", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6" ], "description": ".. image:: https://travis-ci.org/pglass/sqlitis.svg?branch=master\n :target: https://travis-ci.org/pglass/sqlitis\n\n.. image:: https://img.shields.io/pypi/v/sqlitis.svg\n :target: https://pypi.python.org/pypi/sqlitis\n\n.. image:: https://img.shields.io/pypi/pyversions/sqlitis.svg\n :target: https://pypi.python.org/pypi/sqlitis\n\n\n=========\n sqlitis\n=========\n\nThis is a tool to convert plain SQL queries to SQLAlchemy expressions. It is usable from the command line or as a library.\n\nThis converts to the `SQLAlchemy expression language`_. It does not support the SQLAlchemy ORM.\n\n.. code-block:: bash\n\n $ pip install sqlitis\n\nExamples\n--------\n\nTurning a select query into a sqlachemy expression:\n\n.. code-block:: bash\n\n $ sqlitis 'select foo.name, bar.value from foo join bar'\n select([foo.c.name, bar.c.value]).select_from(foo.join(bar))\n\n\nConverting a join:\n\n.. code-block:: bash\n\n $ sqlitis 'foo join bar on foo.id = bar.foo_id and (foo.val < 100 or bar.val < 100)'\n foo.join(bar, and_(foo.c.id == bar.c.foo_id, or_(foo.c.val < 100, bar.c.val < 100)))\n\nRunning tests\n-------------\n\nThis repository includes a data-driven test suite as well as style checks (with `flake8`_) and automatic code formatting (with `yapf`_).\n\nUse tox to run the tests.\n\n.. code-block:: bash\n\n $ pip install tox\n ### Run everything\n $ tox\n ### Run just the unit/functional tests\n $ tox -e py27\n ### Run just style/formatting checks\n $ tox -e flake8\n\n`yapf`_ is used to automatically fix code style/formatting errors. It will reformat your code in place.\n\n.. code-block:: bash\n\n ### Auto-fix style/formatting checks\n $ tox -e yapf\n\nThere are three types of tests:\n\n- Unit tests of the internal models\n- Unit tests of the core `to_sqla` function\n- Functional tests that execute the generated SQLAlchemy expressions, against a sqlite database.\n\nMost of these tests are generated from data in ``tests/data.json``.\n\nSQL Support Checklist\n---------------------\n\n- [ ] Select\n\n - [x] Star: ``SELECT * FROM foo``\n - [x] Multiple columns: ``SELECT a, b, c FROM foo``\n - [x] Qualified column names: ``SELECT foo.a, foo.b FROM foo``\n - [x] Column aliases: ``SELECT foo.id AS foo_id, foo.name AS foo_name from FOO``\n - [ ] Joins\n\n - [x] Plain Join: ``SELECT foo.a, bar.b FROM foo JOIN bar``\n - [x] Inner Join: ``SELECT foo.a, bar.b FROM foo INNER JOIN bar``\n - [ ] Left/Right Joins\n - [ ] Outer Joins\n\n - [x] On Clauses: ``SELECT foo.a, bar.b FROM foo JOIN bar ON foo.id = bar.foo_id``\n - [x] Conjuctions (AND/OR): ``SELECT foo.a, bar.b FROM foo join bar ON foo.id = bar.foo_id AND foo.val > 1``\n - [x] Select from subquery: ``SELECT id FROM (SELECT * FROM foo)``\n - [x] Where: ``SELECT id FROM foo WHERE id = 123``\n - [x] Between: ``SELECT a FROM foo WHERE foo.val BETWEEN 1 AND 20``\n - [x] Select distinct: ``SELECT DISTINCT a FROM foo``\n - [ ] Aggregate functions (SUM, AVG, COUNT, MIN, MAX): ``SELECT COUNT(*) FROM foo``\n - [ ] Group by: ``SELECT COUNT(*) FROM foo GROUP BY column``\n - [ ] Like\n - [ ] Limit/offset\n - [ ] Order by\n\n- [ ] Insert\n- [ ] Update\n- [ ] Delete\n\n.. _SQLAlchemy expression language: http://docs.sqlalchemy.org/en/latest/core/tutorial.html#sql-expression-language-tutorial\n.. _flake8: http://flake8.pycqa.org/en/latest/\n.. _yapf: https://github.com/google/yapf\n", "description_content_type": "", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/pglass/sqlitis", "keywords": "sql sqlalchemy convert sqlitis", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "sqlitis", "package_url": "https://pypi.org/project/sqlitis/", "platform": "", "project_url": "https://pypi.org/project/sqlitis/", "project_urls": { "Homepage": "https://github.com/pglass/sqlitis" }, "release_url": "https://pypi.org/project/sqlitis/0.0.3/", "requires_dist": null, "requires_python": "", "summary": "convert sql to sqlalchemy expressions", "version": "0.0.3" }, "last_serial": 4167316, "releases": { "0.0.1": [ { "comment_text": "", "digests": { "md5": "e06915aec5eee69fcf6bd784bc0ca5e4", "sha256": "ac3650bb7cf3c325fd742ced0565cd6a2e8d433a4ce34d6a8c293fc567c8859a" }, "downloads": -1, "filename": "sqlitis-0.0.1.tar.gz", "has_sig": false, "md5_digest": "e06915aec5eee69fcf6bd784bc0ca5e4", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7662, "upload_time": "2018-02-02T05:07:18", "url": "https://files.pythonhosted.org/packages/bc/7b/8ecbd3cf927fd72be2358c7102dd9415f50a4e48a11a0165d8166dd80fa7/sqlitis-0.0.1.tar.gz" } ], "0.0.2": [ { "comment_text": "", "digests": { "md5": "84fbe18632149cebc04d1178498eb4f6", "sha256": "e06c67ea44ea560f627120ae091558c18615608fc8e24a24479b35a0f4dd8dd1" }, "downloads": -1, "filename": "sqlitis-0.0.2.tar.gz", "has_sig": false, "md5_digest": "84fbe18632149cebc04d1178498eb4f6", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7531, "upload_time": "2018-02-02T05:40:33", "url": "https://files.pythonhosted.org/packages/ba/a4/f1e686fe8561da886481ce5995952f69302e76c7cdda4fc4c592d2fd6067/sqlitis-0.0.2.tar.gz" } ], "0.0.3": [ { "comment_text": "", "digests": { "md5": "ec0b297361faab1eb0f4de642e155b54", "sha256": "ccc50fcd88335c27ba9c288471b0ede09f938421ce7d0aa132680325f576bd4a" }, "downloads": -1, "filename": "sqlitis-0.0.3.tar.gz", "has_sig": false, "md5_digest": "ec0b297361faab1eb0f4de642e155b54", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7837, "upload_time": "2018-08-14T00:24:22", "url": "https://files.pythonhosted.org/packages/3c/63/7a01426c710a0600edd87ee9192769069e7b266d234431e728068e950649/sqlitis-0.0.3.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "ec0b297361faab1eb0f4de642e155b54", "sha256": "ccc50fcd88335c27ba9c288471b0ede09f938421ce7d0aa132680325f576bd4a" }, "downloads": -1, "filename": "sqlitis-0.0.3.tar.gz", "has_sig": false, "md5_digest": "ec0b297361faab1eb0f4de642e155b54", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7837, "upload_time": "2018-08-14T00:24:22", "url": "https://files.pythonhosted.org/packages/3c/63/7a01426c710a0600edd87ee9192769069e7b266d234431e728068e950649/sqlitis-0.0.3.tar.gz" } ] }