{ "info": { "author": "Aaron Zhang", "author_email": "rabbit.aaron@gmail.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 4 - Beta", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Programming Language :: Python :: 2", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.4", "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6" ], "description": "django-print-sql\r\n================\r\n\r\ndjango-print-sql is an easy-to-use SQL debug tool for Django developers to print SQL statements\r\n\r\n\r\nWhat's new\r\n----------\r\n\r\n**2018.3.6**\r\n\r\n* Added a decorator\r\n* It now prints how long it takes each query to execute, as well as the total time elapsed\r\n\r\nRequirements\r\n------------\r\n\r\nYou need to have django installed (obviously).\r\n\r\nI've tried it on Django 1.11.11 and 2.0.3.\r\n\r\nIf sqlparse is installed, the SQL statement wil be formatted.\r\n\r\nInstall\r\n-------\r\n\r\nFrom pip, run::\r\n\r\n $ pip install --upgrade django-print-sql\r\n\r\nConsider using the ``--user`` option_.\r\n\r\n.. _option: https://pip.pypa.io/en/latest/user_guide/#user-installs\r\n\r\nFrom the repository, run::\r\n\r\n python setup.py install\r\n\r\nto install django-print-sql on your system.\r\n\r\ndjango-print-sql is compatible with Python 2.7 and Python 3 (>= 3.3) (hopefully :D).\r\n\r\nInstall sqlparse to pretty print the statements::\r\n\r\n $ pip install --upgrade sqlparse\r\n\r\nUsage\r\n-----\r\nExample 1. Use as context manager::\r\n\r\n from django_print_sql import print_sql\r\n \r\n # set `count_only` to `True` will print the number of executed SQL statements only\r\n with print_sql(count_only=False):\r\n\r\n # write the code you want to analyze in here,\r\n # e.g. some complex foreign key lookup,\r\n # or analyzing a DRF serializer's performance\r\n\r\n for user in User.objects.all()[:10]:\r\n user.groups.first()\r\n\r\nExample 2. Use as decorator::\r\n\r\n from django_print_sql import print_sql_decorator\r\n\r\n\r\n @print_sql_decorator(count_only=False) # this works on class-based views as well\r\n def get(request):\r\n # your view code here\r\n\r\nLinks\r\n-----\r\n\r\nProject Page\r\n https://github.com/rabbit-aaron/django-print-sql\r\n\r\ndjango-print-sql is licensed under the MIT license.\r\n\r\nParts of the readme are based on sqlparse's readme file.\r\nsqlparse: https://github.com/andialbrecht/sqlparse\r\n", "description_content_type": "", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/rabbit-aaron/django-print-sql", "keywords": "django sql debug", "license": "", "maintainer": "", "maintainer_email": "", "name": "django-print-sql", "package_url": "https://pypi.org/project/django-print-sql/", "platform": "", "project_url": "https://pypi.org/project/django-print-sql/", "project_urls": { "Homepage": "https://github.com/rabbit-aaron/django-print-sql" }, "release_url": "https://pypi.org/project/django-print-sql/2018.3.6/", "requires_dist": null, "requires_python": "", "summary": "django_print_sql is an easy-to-use SQL debug tool for Django developers to print SQL statements", "version": "2018.3.6" }, "last_serial": 3671242, "releases": { "2018.3.4": [ { "comment_text": "", "digests": { "md5": "4d6cd6bc4baab1e70c5e69d0fe6c4b02", "sha256": "e27b8aab827f198db75eaabb261801e098f588bf8911ca9fd18b9bbdce1f590b" }, "downloads": -1, "filename": "django-print-sql-2018.3.4.tar.gz", "has_sig": false, "md5_digest": "4d6cd6bc4baab1e70c5e69d0fe6c4b02", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 2739, "upload_time": "2018-03-09T10:55:21", "url": "https://files.pythonhosted.org/packages/d6/ff/f451d74d5a1383ed99035ef6a0a1a9010d4bde83b7a5b0dc7ef180b41928/django-print-sql-2018.3.4.tar.gz" } ], "2018.3.6": [ { "comment_text": "", "digests": { "md5": "7971c2fcb55cf6fb15d8f1ef497987ac", "sha256": "283a16b252b330a3009158a4b010f9db96c60380dcbdc4c2d2d8d2eba105c47e" }, "downloads": -1, "filename": "django-print-sql-2018.3.6.tar.gz", "has_sig": false, "md5_digest": "7971c2fcb55cf6fb15d8f1ef497987ac", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3145, "upload_time": "2018-03-15T04:26:20", "url": "https://files.pythonhosted.org/packages/3e/34/a21c40a7ec37c8cdb4f1d593ec69601baab13bf27cde5574afab35dd5f7f/django-print-sql-2018.3.6.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "7971c2fcb55cf6fb15d8f1ef497987ac", "sha256": "283a16b252b330a3009158a4b010f9db96c60380dcbdc4c2d2d8d2eba105c47e" }, "downloads": -1, "filename": "django-print-sql-2018.3.6.tar.gz", "has_sig": false, "md5_digest": "7971c2fcb55cf6fb15d8f1ef497987ac", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3145, "upload_time": "2018-03-15T04:26:20", "url": "https://files.pythonhosted.org/packages/3e/34/a21c40a7ec37c8cdb4f1d593ec69601baab13bf27cde5574afab35dd5f7f/django-print-sql-2018.3.6.tar.gz" } ] }