{ "info": { "author": "Keryn Knight", "author_email": "django-storedqueries@kerynknight.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 3 - Alpha", "Framework :: Django", "Framework :: Django :: 1.10", "Framework :: Django :: 1.11", "Framework :: Django :: 1.4", "Framework :: Django :: 1.5", "Framework :: Django :: 1.6", "Framework :: Django :: 1.7", "Framework :: Django :: 1.8", "Framework :: Django :: 1.9", "Intended Audience :: Developers", "License :: OSI Approved :: BSD License", "Natural Language :: English", "Programming Language :: Python :: 2", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.5" ], "description": "django-storedqueries\n====================\n\n:author: Keryn Knight\n:version: 0.1.4\n\nA small package for `Django`_ to ease the creation of database temporary tables.\n\nIt doesn't need to be in your ``INSTALLED_APPS``\n\nUsage\n-----\n\nDefine a mostly normal Django model, like so::\n\n from django.db import models\n\n class MyCoolModel(models.Model):\n value = models.PositiveIntegerField(primary_key=True)\n\n class Meta:\n abstract = True\n managed = False\n\nPay special attention to the ``Meta`` attributes. It'll complain otherwise.\n\nProvide a definition for the temporary table somewhere::\n\n from storedqueries import TemporaryTable\n\n class MyTemporaryTable(TemporaryTable):\n model = MyCoolModel\n queryset = Somedata.objects.order_by('?').annotate(value=models.F('key_name')).values_list('value').iterator()\n\nMake use of the temporary table::\n\n from django.http import JsonResponse\n\n def myview(request, *args, **kwargs):\n with MyTemporaryTable() as TemporaryModel:\n keys = TemporaryModel.objects.all()\n data = tuple(Somedata.objects.filter(key_name__in=keys))\n return JsonResponse({'values': data})\n\nUsing the ``with my_cls() as thing:`` syntax will create a uniquely named\ntemporary table using the ``queryset`` connection and data to fill it,\nwhen the ``with`` scope closes, the temporary table is dropped. The\n``TemporaryModel`` variable will be a **subclass** of ``MyCoolModel`` bound to\nthe unique name for the temporary table.\n\nIf you have a query which cannot be defined at module scope, you can do::\n\n class MyTemporaryTable(TemporaryTable):\n model = MyCoolModel\n def source_queryset(self):\n return Somedata.objects.filter(created__lte=timezone.now()).annotate(value=models.F('key_name')).values_list('value').iterator()\n\nIf you **still** cannot get the query correct, because it has a dependency\non something like ``request.user`` etc, you can do::\n\n def myview(request, *args, **kwargs):\n qs = Somedata.objects.filter(user=request.user.pk)\n with MyTemporaryTable(queryset=qs) as TemporaryModel:\n raise NotImplementedError(\"Dynamic queryset binding\")\n\nor probably even::\n\n def myview(request, *args, **kwargs):\n qs = Somedata.objects.filter(user=request.user.pk)\n with TemporaryTable(model=MyCoolModel, queryset=qs) as TemporaryModel:\n raise NotImplementedError(\"Dynamic model AND queryset binding\")\n\nThe license\n-----------\n\nIt's `FreeBSD`_. There's should be a ``LICENSE`` file in the root of the repository, and in any archives.\n\n.. _FreeBSD: http://en.wikipedia.org/wiki/BSD_licenses#2-clause_license_.28.22Simplified_BSD_License.22_or_.22FreeBSD_License.22.29\n.. _Django: https://www.djangoproject.com/\n\n\n----\n\nCopyright (c) 2019, Keryn Knight\nAll rights reserved.\n\nRedistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:\n\n1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.\n\n2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\n\n----\n\nChange history for django-storedqueries\n-------------------------------------------------------------\n0.1.4\n^^^^^^\n\n* Changed the ``open`` and ``close`` methods of ``TemporaryTableEditor`` to avoid using the cursor as a context manager for greater compatibility (ie: I have an old internal project where this could be useful)\n\n0.1.3\n^^^^^^\n\n* Raise an exception at runtime if the temporary model being passed in delares ``ForeignKey`` etc without setting ``related_name=\"+\"`` for each.\n* Add functionality for MySQL to detect if it can use the ``MEMORY`` engine.\n\n0.1.2\n^^^^^^\n* Initial release\n\n\n", "description_content_type": "", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/kezabelle/django-storedqueries", "keywords": "django orm temporary tables queries", "license": "BSD License", "maintainer": "Keryn Knight", "maintainer_email": "django-storedqueries@kerynknight.com", "name": "django-storedqueries", "package_url": "https://pypi.org/project/django-storedqueries/", "platform": "", "project_url": "https://pypi.org/project/django-storedqueries/", "project_urls": { "Homepage": "https://github.com/kezabelle/django-storedqueries" }, "release_url": "https://pypi.org/project/django-storedqueries/0.1.4/", "requires_dist": [ "Django (>=1.4)" ], "requires_python": "", "summary": "A small package for Django to ease the creation of temporary tables, based on model definitions and querysets", "version": "0.1.4" }, "last_serial": 5606241, "releases": { "0.1.2": [ { "comment_text": "", "digests": { "md5": "68a19896a008d277c801f4f921702112", "sha256": "a64a827b20ae7bd6cf97bf441be0d67deb31f1213b97c4b4212615063322f2f8" }, "downloads": -1, "filename": "django_storedqueries-0.1.2-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "68a19896a008d277c801f4f921702112", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 9539, "upload_time": "2019-06-21T14:27:19", "url": "https://files.pythonhosted.org/packages/b9/31/f297a8cc879aeb35e21e1ba591db4e05ee3a14db3e3605a16c1be58ae214/django_storedqueries-0.1.2-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "fca5637f5931ab0dde034de5ea98eadb", "sha256": "6a88669e5b67160740f9fae6a1e61a9bdc8816f009fb9ed9aeaa025795b16636" }, "downloads": -1, "filename": "django-storedqueries-0.1.2.tar.gz", "has_sig": false, "md5_digest": "fca5637f5931ab0dde034de5ea98eadb", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 9661, "upload_time": "2019-06-21T14:27:21", "url": "https://files.pythonhosted.org/packages/ab/e5/80f725f97f49bf61a048f02d99c38c140c49dc95c1a7f43ad08d0065fb75/django-storedqueries-0.1.2.tar.gz" } ], "0.1.3": [ { "comment_text": "", "digests": { "md5": "efc9e7ef7b81d4796f68ae3f95879654", "sha256": "325787b3657eabeecc9dd97f56f09305a2bd419bbe77b70109fcd9724563ca88" }, "downloads": -1, "filename": "django_storedqueries-0.1.3-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "efc9e7ef7b81d4796f68ae3f95879654", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 10047, "upload_time": "2019-07-29T07:40:16", "url": "https://files.pythonhosted.org/packages/b1/1c/be4666d16ceb5205c78d45b2b98b607791b7af714fb9fbcbeaa91719891c/django_storedqueries-0.1.3-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "0b990df2abe8f74b3361449fd187c708", "sha256": "b850211e47fcc9c36e3b93fde3da5226e34615ad820d4c17540af126666d614c" }, "downloads": -1, "filename": "django-storedqueries-0.1.3.tar.gz", "has_sig": false, "md5_digest": "0b990df2abe8f74b3361449fd187c708", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 10162, "upload_time": "2019-07-29T07:40:18", "url": "https://files.pythonhosted.org/packages/11/86/1399882449e1ebdb61e8407e068128864cc307857d795a921c00dcd34bb5/django-storedqueries-0.1.3.tar.gz" } ], "0.1.4": [ { "comment_text": "", "digests": { "md5": "60582340aad2a3d4b86a917ea6bab8c0", "sha256": "ceeb0849ede01c80a0298b60bd39786bb662a44c849c0e50ebb4ec132035fe44" }, "downloads": -1, "filename": "django_storedqueries-0.1.4-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "60582340aad2a3d4b86a917ea6bab8c0", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 10198, "upload_time": "2019-07-30T07:28:58", "url": "https://files.pythonhosted.org/packages/eb/93/0b10bee394e9e1218a5f84a4fe161cf4b13cf2a24df986b1f193260f1866/django_storedqueries-0.1.4-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "323b9c7ef680038b1bf1663c21a15f1b", "sha256": "aed8248e10fa30995b499f1114af96997f4b7c04d1205efa93ede0e8d532f49d" }, "downloads": -1, "filename": "django-storedqueries-0.1.4.tar.gz", "has_sig": false, "md5_digest": "323b9c7ef680038b1bf1663c21a15f1b", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 10314, "upload_time": "2019-07-30T07:29:00", "url": "https://files.pythonhosted.org/packages/27/4a/8281329803db5a120aca036d78128b4ae0c99442aca41119de002818e6f3/django-storedqueries-0.1.4.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "60582340aad2a3d4b86a917ea6bab8c0", "sha256": "ceeb0849ede01c80a0298b60bd39786bb662a44c849c0e50ebb4ec132035fe44" }, "downloads": -1, "filename": "django_storedqueries-0.1.4-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "60582340aad2a3d4b86a917ea6bab8c0", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 10198, "upload_time": "2019-07-30T07:28:58", "url": "https://files.pythonhosted.org/packages/eb/93/0b10bee394e9e1218a5f84a4fe161cf4b13cf2a24df986b1f193260f1866/django_storedqueries-0.1.4-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "323b9c7ef680038b1bf1663c21a15f1b", "sha256": "aed8248e10fa30995b499f1114af96997f4b7c04d1205efa93ede0e8d532f49d" }, "downloads": -1, "filename": "django-storedqueries-0.1.4.tar.gz", "has_sig": false, "md5_digest": "323b9c7ef680038b1bf1663c21a15f1b", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 10314, "upload_time": "2019-07-30T07:29:00", "url": "https://files.pythonhosted.org/packages/27/4a/8281329803db5a120aca036d78128b4ae0c99442aca41119de002818e6f3/django-storedqueries-0.1.4.tar.gz" } ] }