{ "info": { "author": "Chris Streeter", "author_email": "chris@educreations.com", "bugtrack_url": null, "classifiers": [ "Environment :: Web Environment", "Framework :: Django", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", "Programming Language :: Python", "Programming Language :: Python :: 2.7", "Topic :: Software Development" ], "description": "Django MySQL Fuzzycount\n=======================\n\nWhen using MySQL, `counting all rows`_ is very expensive on large InnoDB tables. This is a replacement for ``QuerySet`` that returns an approximation if ``COUNT(*)`` is called with no additional constraints. In all other cases it should behave exactly as QuerySet.\n\nThis only works with MySQL and behaves normally for all other engines.\n\n\nInstallation\n------------\n\nInstall the package ``django-mysql-fuzzycount`` from PyPI using `pip`_::\n\n $ pip install -U django-mysql-fuzzycount\n\n\nUsage\n-----\n\nThere are a couple ways to use the ``FuzzyCountQuerySet``.\n\nYou can import and use the provided ``FuzzyCountManager`` on your Django models::\n\n from django.db import models\n\n from mysql_fuzzycount.managers import FuzzyCountManager\n\n class Choice(model.Model):\n objects = FuzzyCountManager()\n\n # ...\n\nThen, doing a count on the ``Choice`` model, without any constraints, will approximate the total count::\n\n >>> Choice.objects.count() # approximation\n 100\n >>> Choice.objects.filter(votes__gt=10).count() # not an approximation\n 28\n\nAnother common issue is counts in the admin for a model. There is a base ``ModelAdmin`` class that you can subclass in your ``admin.py`` files to prevent expensive ``COUNT(*)`` queries upon loading the admin page. In an ``admin.py`` for one of your models::\n\n from django.contrib import admin\n\n from mysql_fuzzycount.admin import FuzzyCountModelAdmin\n\n from myapp.models import Choice\n\n\n class ChoiceAdmin(FuzzyCountModelAdmin):\n pass\n\n admin.site.register(Choice, ChoiceAdmin)\n\nNow, when you load the admin page for the ``Choice`` model, the count for pagination will be approximate.\n\n\nTesting\n-------\n\nIt has been tested in production, but there are no unit or integration tests.\n\n\nLicense\n-------\n\nCopyright \u00a9 2013, Educreations, Inc under the MIT LICENSE.\n\n\n.. _`counting all rows`: http://www.mysqlperformanceblog.com/2006/12/01/count-for-innodb-tables/\n.. _`pip`: http://www.pip-installer.org/\n", "description_content_type": "", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/educreations/django-mysql-fuzzycount", "keywords": "mysql orm django", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "django-mysql-fuzzycount", "package_url": "https://pypi.org/project/django-mysql-fuzzycount/", "platform": "", "project_url": "https://pypi.org/project/django-mysql-fuzzycount/", "project_urls": { "Homepage": "https://github.com/educreations/django-mysql-fuzzycount" }, "release_url": "https://pypi.org/project/django-mysql-fuzzycount/0.4/", "requires_dist": null, "requires_python": "", "summary": "Approximate query counts for MySQL and Django.", "version": "0.4" }, "last_serial": 4281059, "releases": { "0.1": [ { "comment_text": "", "digests": { "md5": "e723323748bd561b523940e75c0f6ddb", "sha256": "47b84aca6e94e1f752227b13794c42facf41bbc0da0ba551c5042ec4846e05f5" }, "downloads": -1, "filename": "django_mysql_fuzzycount-0.1-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "e723323748bd561b523940e75c0f6ddb", "packagetype": "bdist_wheel", "python_version": "2.7", "requires_python": null, "size": 6207, "upload_time": "2013-12-24T21:12:23", "url": "https://files.pythonhosted.org/packages/a4/d8/edd62309b8a0445fb5978ae9c89cb82b834a3b38ea300b7e4272d12e89d2/django_mysql_fuzzycount-0.1-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "a9e67c6022b36c9bdd76992663a45deb", "sha256": "adbdf4024fe12394cd91af3777bab3f7ef4b895e79e5ce56257d09508ed2f4b3" }, "downloads": -1, "filename": "django-mysql-fuzzycount-0.1.tar.gz", "has_sig": false, "md5_digest": "a9e67c6022b36c9bdd76992663a45deb", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4153, "upload_time": "2013-12-24T21:12:05", "url": "https://files.pythonhosted.org/packages/f6/05/40ded2f32a01af97f9ea581c79b8af4baeab375f73798ccf48f7fa91bdc3/django-mysql-fuzzycount-0.1.tar.gz" } ], "0.2": [ { "comment_text": "", "digests": { "md5": "fba594148adad12457afe81f0875bf1f", "sha256": "b237772bdb5588745a534471930b655facea8a3869072ae24d7d5874722cf46f" }, "downloads": -1, "filename": "django_mysql_fuzzycount-0.2-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "fba594148adad12457afe81f0875bf1f", "packagetype": "bdist_wheel", "python_version": "2.7", "requires_python": null, "size": 6056, "upload_time": "2014-01-16T19:49:22", "url": "https://files.pythonhosted.org/packages/97/63/e19e49c5eef6b56164777b60beeb48512d635a69ef73acc430428ab43d21/django_mysql_fuzzycount-0.2-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "64b0989861c8ea9f0aa0eb4bf9d4969b", "sha256": "b6a12a4b8e55cd089254dc5f78d2608a124679efa25428491805c3573a8c8288" }, "downloads": -1, "filename": "django-mysql-fuzzycount-0.2.tar.gz", "has_sig": false, "md5_digest": "64b0989861c8ea9f0aa0eb4bf9d4969b", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4024, "upload_time": "2014-01-16T19:49:15", "url": "https://files.pythonhosted.org/packages/c3/76/aefb85a3bc821c56f61fbda8ffc6417ff7b4111a9ab106f3fd3972d58397/django-mysql-fuzzycount-0.2.tar.gz" } ], "0.3": [ { "comment_text": "", "digests": { "md5": "0e0f1d8c43cde95fd16b5c7db814df16", "sha256": "74dd327517f298d127a5ee4142fee4f450131cc680e36ab6b1790d155190ef82" }, "downloads": -1, "filename": "django_mysql_fuzzycount-0.3-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "0e0f1d8c43cde95fd16b5c7db814df16", "packagetype": "bdist_wheel", "python_version": "2.7", "requires_python": null, "size": 6266, "upload_time": "2014-09-02T02:04:41", "url": "https://files.pythonhosted.org/packages/e5/f5/2caf7acd4fc09f277065f13f03ab78f84683ecea6ec0438066205c785360/django_mysql_fuzzycount-0.3-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "7106599bf92c3df975ad5d780191f1e7", "sha256": "b55517745790030ce2474bd01df5870da316c12923d016a5793d1fb06c725e83" }, "downloads": -1, "filename": "django-mysql-fuzzycount-0.3.tar.gz", "has_sig": false, "md5_digest": "7106599bf92c3df975ad5d780191f1e7", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4111, "upload_time": "2014-09-02T02:04:32", "url": "https://files.pythonhosted.org/packages/84/5a/8d12eb2f773aca481280e317ebba2b57951d0383d8aff26594eb24ffa826/django-mysql-fuzzycount-0.3.tar.gz" } ], "0.4": [ { "comment_text": "", "digests": { "md5": "c4341e01f630ccfe6242e2be61383251", "sha256": "ef4538aead1f36b350331294e56d1f5e2e826188c5ba11b89f2df40cb226a1e0" }, "downloads": -1, "filename": "django_mysql_fuzzycount-0.4-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "c4341e01f630ccfe6242e2be61383251", "packagetype": "bdist_wheel", "python_version": "2.7", "requires_python": null, "size": 4366, "upload_time": "2018-09-17T21:58:18", "url": "https://files.pythonhosted.org/packages/7e/bd/703ceabbe4de242ba73fe7e4f8e2c622b33e9aed618f7af4ab775487234b/django_mysql_fuzzycount-0.4-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "5b9118630f4c64037ce381aa335c0869", "sha256": "95bf50b3698ab15a1d3be0d22e87d932f70b6eebd3ebfeb66bafc03b9e064939" }, "downloads": -1, "filename": "django-mysql-fuzzycount-0.4.tar.gz", "has_sig": false, "md5_digest": "5b9118630f4c64037ce381aa335c0869", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4103, "upload_time": "2018-09-17T21:58:15", "url": "https://files.pythonhosted.org/packages/fa/d4/12e9c5a5081ec484210c9d42382e69b95e75179d870feaae0c9c67fa69fd/django-mysql-fuzzycount-0.4.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "c4341e01f630ccfe6242e2be61383251", "sha256": "ef4538aead1f36b350331294e56d1f5e2e826188c5ba11b89f2df40cb226a1e0" }, "downloads": -1, "filename": "django_mysql_fuzzycount-0.4-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "c4341e01f630ccfe6242e2be61383251", "packagetype": "bdist_wheel", "python_version": "2.7", "requires_python": null, "size": 4366, "upload_time": "2018-09-17T21:58:18", "url": "https://files.pythonhosted.org/packages/7e/bd/703ceabbe4de242ba73fe7e4f8e2c622b33e9aed618f7af4ab775487234b/django_mysql_fuzzycount-0.4-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "5b9118630f4c64037ce381aa335c0869", "sha256": "95bf50b3698ab15a1d3be0d22e87d932f70b6eebd3ebfeb66bafc03b9e064939" }, "downloads": -1, "filename": "django-mysql-fuzzycount-0.4.tar.gz", "has_sig": false, "md5_digest": "5b9118630f4c64037ce381aa335c0869", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4103, "upload_time": "2018-09-17T21:58:15", "url": "https://files.pythonhosted.org/packages/fa/d4/12e9c5a5081ec484210c9d42382e69b95e75179d870feaae0c9c67fa69fd/django-mysql-fuzzycount-0.4.tar.gz" } ] }