{ "info": { "author": "Alan Illing", "author_email": "alanilling@protonmail.com", "bugtrack_url": null, "classifiers": [ "Environment :: Web Environment", "Framework :: Django", "Framework :: Django :: 1.11", "Intended Audience :: Developers", "License :: OSI Approved :: Apache Software License", "Operating System :: OS Independent", "Programming Language :: Python", "Programming Language :: Python :: 3.4", "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6", "Topic :: Database", "Topic :: Database :: Front-Ends" ], "description": "# Django BulkModel\n\nBulkModel adds additional features that makes it easier to interact with data in bulk.\n\nBelow is a brief summary of the project. **Read the [full documentation](https://django-bulkmodel.readthedocs.io/)**\n\n---\n\n\n## BulkModels and features\n\nCreate a bulkmodel by inheriting from `BulkModel`:\n\n from bulkmodel.models import BulkModel\n\n class Foo(BulkModel):\n name = models.CharField(max_length=50, blank=False)\n value = models.IntegerField(null=False)\n\n\nHere's some new functionality that's available to you now:\n\n### 1) Get a queryset after a bulk create\n\nSometimes you need created data to be returned from the database\nwith a primary key assigned to each model instance for full processing.\n\nThis is typically the case when you bulk create some data and then\nwant to assign foreign keys to other models, thereby requiring the primary keys\non the new data.\n\n\n from random import randint, random, string\n\n ls = []\n for i in range(10):\n ls.append(Foo(\n # random string\n name = ''.join(random.choices(string.ascii_uppercase, 25)),\n\n # random value\n value = randint(0, 1000),\n ))\n\n # create instances and return a queryset of the created items\n foos = Foo.objects.bulk_create(ls, return_queryset=True)\n\n\n### 2) Heterogeneous updates\n\nDjango's `update()` queryset method allows you to update **homogeneous data**.\n\nThat is, all the model instances in the queryset are updated to the same value (or applied\nthe same change when using F expressions) for the specified columns.\n\nBulkModels allow you to update data **heterogeneously**. That is,\neach model instance in a queryset can take on a different value in a single query execution.\n\nTo do this, use the `update_fields()` queryset method, like so:\n\n for foo in foos:\n foo.value += randint(100, 200)\n\n # update all fields that changed\n foos.update_fields()\n\n # or update just the value field\n foos.update_fields('value')\n\nThis will only execute one query, regardless of how many fields are in the model are updated.\n\n\n### 3) Concurrent writes\n\nBulkModels support concurrent writes out of the box, which can significantly\nspeed up write time given a large enough database server.\n\nConcurrent writes are available on all the write queryset methods\n(`bulk_create`, `update`, `update_fields`, `copy_from_objects`).\n\n foos = ...\n\n # concurrently write foos into the database\n Foo.objects.bulk_create(foos, concurrent=True, batch_size=1000, max_concurrent_workers=10)\n\n # a regular (homogeneous) update can be written concurrently\n foos.update(concurrent=True, batch_size=1000, max_concurrent_workers=10)\n\n # and so can a heterogeneous update\n foos.update_fields(concurrent=True, batch_size=1000, max_concurrent_workers=10)\n\n\n### 4) Additional signals\n\nDjango ships with the following signals for interacting with data:\n\n- Saving a single instance: `pre_save` and `post_save`\n- Deleting data: `pre_delete` and `post_delete`\n- Changing a many to many relationship: `m2m_changed`\n\nWhat's missing from this list are signals when data is created in bulk and updated in bulk.\n\nBulkModels ship with additional signals when data is created:\n\n\n- `pre_bulk_create` / `post_bulk_create` are fired when data is being written from `bulk_create`\n- `pre_copy_from_instances` / `post_copy_from_instances` are fired when data is being written from a data buffer (via the `copy_from_objects` queryset method)\n\n\nAnd these signals when data is updated:\n\n- `pre_update` / `post_update` are fired when a homogeneous update is applied\n- `pre_update_fields` / `post_update_fields` are fired when a heterogeneous update is applied\n\n\nYou can optionally turn off signal emission in any write function by setting `send_signals=False`\n(signals are emitted by default).\n\n### 5) More\n\nA few more features come with BulkModels, like offline connection management,\ncopying data to and from the database via in-memory buffers, and queryset chunking.\n\n[See the full list of features](https://django-bulkmodel.readthedocs.io/en/latest/pages/overview-all-features.html)\n\n---\n\n## Installation\n\nFirst make sure you have django >= 1.9 installed. It's always\nrecommended to update to the latest version of Django.\n\nFor concurrency features to work you'll need Python 3.4+ and access to asyncio\n\nThen install the package from pypi:\n\n pip install django-bulkmodel\n\nAdd `bulkmodel` to your `INSTALLED_APPS`:\n\n INSTALLED_APPS = [\n ...\n 'bulkmodel',\n ]\n\n\nInherit your existing models from `BulkModel`, or create new models to inherit\nfrom this class:\n\n from django.db import models\n from bulkmodel.models import BulkModel\n\n class MyModel(BulkModel):\n ...\n\n\nMake migrations:\n\n ./manage.py makemigrations # for new apps\n ./manage.py makemigrations # for existing apps with migrations\n\nAnd apply them:\n\n ./manage.py migrate\n\n\nYou can also do a partial installation if you don't want to migrate all your models.\n\nFor more instructions [read the full installation instructions documentation](https://django-bulkmodel.readthedocs.io/en/latest/pages/installation.html)\n\n\n\n---\n\n## Full documentation\n\n[Read the full documentation](https://django-bulkmodel.readthedocs.io/)\n\n## License\n\nThis software is made available under the Apache v2 License; see the LICENSE file for details.\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/ailling/django-bulkmodel", "keywords": "django", "license": "Apache Software License", "maintainer": "", "maintainer_email": "", "name": "django-bulkmodel", "package_url": "https://pypi.org/project/django-bulkmodel/", "platform": "", "project_url": "https://pypi.org/project/django-bulkmodel/", "project_urls": { "Homepage": "https://github.com/ailling/django-bulkmodel" }, "release_url": "https://pypi.org/project/django-bulkmodel/0.3.0/", "requires_dist": null, "requires_python": "", "summary": "Adds missing features to Django ORM for working with data in bulk operations", "version": "0.3.0" }, "last_serial": 4193082, "releases": { "0.1.0": [ { "comment_text": "", "digests": { "md5": "154d44051a4e6da0b95265b86dd78632", "sha256": "5f6d8f0693a59e0662016ece7a2119d0b30f26da8c1808d7763883ae752a1d68" }, "downloads": -1, "filename": "django_bulkmodel-0.1.0-py3-none-any.whl", "has_sig": false, "md5_digest": "154d44051a4e6da0b95265b86dd78632", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 11429, "upload_time": "2018-06-03T22:29:07", "url": "https://files.pythonhosted.org/packages/c8/38/58a89bc4502f4a53a37ad31615ddb584419f6a52a3038bce146d48fc9046/django_bulkmodel-0.1.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "559e2067588e902e7ed6e04a47c55219", "sha256": "aba8821a5389f2e13cc869dfec70e1f4ce9d3233805ed71012b2f784e647930f" }, "downloads": -1, "filename": "django-bulkmodel-0.1.0.tar.gz", "has_sig": false, "md5_digest": "559e2067588e902e7ed6e04a47c55219", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 2473505, "upload_time": "2018-06-03T22:29:09", "url": "https://files.pythonhosted.org/packages/b5/72/44cdfbbd4c522240a3d729691c0a9649485fb76f6a01307a0314f0a1b1a6/django-bulkmodel-0.1.0.tar.gz" } ], "0.1.1": [ { "comment_text": "", "digests": { "md5": "f9d80c0e7b7496fb9254276f893a5929", "sha256": "79abe8b1b5d71c3dac4c497ab758bb01ab8e8f9b57bb7f68ed0439089ae482a8" }, "downloads": -1, "filename": "django_bulkmodel-0.1.1-py3-none-any.whl", "has_sig": false, "md5_digest": "f9d80c0e7b7496fb9254276f893a5929", "packagetype": "bdist_wheel", "python_version": "3.6", "requires_python": null, "size": 11428, "upload_time": "2018-07-30T17:08:07", "url": "https://files.pythonhosted.org/packages/e0/fa/c9495e2c89a26cc8b22cc204469d913bcdf837e870d81513272865c6d8f7/django_bulkmodel-0.1.1-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "2018784994100f890f3873c7ee63aeeb", "sha256": "29a78854cea5f4cfec6b7b49d508fdc7ce1365ca91fe3856b100d4a90f620e56" }, "downloads": -1, "filename": "django-bulkmodel-0.1.1.tar.gz", "has_sig": false, "md5_digest": "2018784994100f890f3873c7ee63aeeb", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 2473559, "upload_time": "2018-07-30T17:08:04", "url": "https://files.pythonhosted.org/packages/12/ba/9a29c71502102201136fa624a0554a2e8f1b773d280da8db46b0ba6b7c5e/django-bulkmodel-0.1.1.tar.gz" } ], "0.1.2": [ { "comment_text": "", "digests": { "md5": "b826d18e0d2a266e6fd242da09e3d739", "sha256": "a2d91f4f6bf2b153a8791be9a5455bb848899a295acfe35a4a9c262e007116c4" }, "downloads": -1, "filename": "django_bulkmodel-0.1.2-py3-none-any.whl", "has_sig": false, "md5_digest": "b826d18e0d2a266e6fd242da09e3d739", "packagetype": "bdist_wheel", "python_version": "3.6", "requires_python": null, "size": 11445, "upload_time": "2018-07-31T01:38:02", "url": "https://files.pythonhosted.org/packages/f0/80/6d84069d6d0f8c3165cb54d35b9b455b9a0d2942e4a0cba8532b9d1a0198/django_bulkmodel-0.1.2-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "c0dd1cc453ed7ef17d18b50c95bb57bc", "sha256": "0d94514a06b69589a680be64256e4d8f5576f0c660c8dd48880768dda8ab9241" }, "downloads": -1, "filename": "django-bulkmodel-0.1.2.tar.gz", "has_sig": false, "md5_digest": "c0dd1cc453ed7ef17d18b50c95bb57bc", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 2473547, "upload_time": "2018-07-31T01:37:59", "url": "https://files.pythonhosted.org/packages/03/fd/b3bd8493f90a5f725f214177c099dd12087027ae638931ccc924ab679b2d/django-bulkmodel-0.1.2.tar.gz" } ], "0.2.0": [ { "comment_text": "", "digests": { "md5": "a68a967a04c74370a4dfc739e798eaf2", "sha256": "fc1607912542d74e2ee6b39de5c91fbd206ab495ab6d6f681e25266bf6c31d49" }, "downloads": -1, "filename": "django_bulkmodel-0.2.0-py3-none-any.whl", "has_sig": false, "md5_digest": "a68a967a04c74370a4dfc739e798eaf2", "packagetype": "bdist_wheel", "python_version": "3.6", "requires_python": null, "size": 12282, "upload_time": "2018-08-13T20:20:17", "url": "https://files.pythonhosted.org/packages/1e/78/f45b2d74fde2d83899932ceeeaef695c50ccc1de6e7bb99b79e1747dd810/django_bulkmodel-0.2.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "c8d5182066d724d2ffc858adb50646b5", "sha256": "a25fc14a54629999ea54a6c2ff08ed0e0d38a0046485c4c9cf8ac5396197f9e2" }, "downloads": -1, "filename": "django-bulkmodel-0.2.0.tar.gz", "has_sig": false, "md5_digest": "c8d5182066d724d2ffc858adb50646b5", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 2474161, "upload_time": "2018-08-13T20:20:16", "url": "https://files.pythonhosted.org/packages/3e/9f/5f3c1d99b1b61969e449658eb60bc8c3914f617ab23722b0d79e28b28d06/django-bulkmodel-0.2.0.tar.gz" } ], "0.3.0": [ { "comment_text": "", "digests": { "md5": "69e0f163b774bc9f884800297a3ac15e", "sha256": "c1f61cbc609d74a71e2f89ca08f95473fe2ff86c0c7563a29909abe00a73c903" }, "downloads": -1, "filename": "django_bulkmodel-0.3.0-py3-none-any.whl", "has_sig": false, "md5_digest": "69e0f163b774bc9f884800297a3ac15e", "packagetype": "bdist_wheel", "python_version": "3.6", "requires_python": null, "size": 12528, "upload_time": "2018-08-21T15:59:28", "url": "https://files.pythonhosted.org/packages/22/3a/2d280c25b5ed5425b4e8e3fbc5e0f2cf2bb2ba12fd2aa87784432b75cff9/django_bulkmodel-0.3.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "330dd0b4d86da3a5f5042c7990efb405", "sha256": "00d5d158a6d1525317de14e1200ecad668d1e1f92f4ed092090709de0b28e286" }, "downloads": -1, "filename": "django-bulkmodel-0.3.0.tar.gz", "has_sig": false, "md5_digest": "330dd0b4d86da3a5f5042c7990efb405", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 2474442, "upload_time": "2018-08-21T15:59:26", "url": "https://files.pythonhosted.org/packages/ee/6b/3c1bb699b8610816a9c3fee0a5c88224462e3fea34970ee51bf980f87eb3/django-bulkmodel-0.3.0.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "69e0f163b774bc9f884800297a3ac15e", "sha256": "c1f61cbc609d74a71e2f89ca08f95473fe2ff86c0c7563a29909abe00a73c903" }, "downloads": -1, "filename": "django_bulkmodel-0.3.0-py3-none-any.whl", "has_sig": false, "md5_digest": "69e0f163b774bc9f884800297a3ac15e", "packagetype": "bdist_wheel", "python_version": "3.6", "requires_python": null, "size": 12528, "upload_time": "2018-08-21T15:59:28", "url": "https://files.pythonhosted.org/packages/22/3a/2d280c25b5ed5425b4e8e3fbc5e0f2cf2bb2ba12fd2aa87784432b75cff9/django_bulkmodel-0.3.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "330dd0b4d86da3a5f5042c7990efb405", "sha256": "00d5d158a6d1525317de14e1200ecad668d1e1f92f4ed092090709de0b28e286" }, "downloads": -1, "filename": "django-bulkmodel-0.3.0.tar.gz", "has_sig": false, "md5_digest": "330dd0b4d86da3a5f5042c7990efb405", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 2474442, "upload_time": "2018-08-21T15:59:26", "url": "https://files.pythonhosted.org/packages/ee/6b/3c1bb699b8610816a9c3fee0a5c88224462e3fea34970ee51bf980f87eb3/django-bulkmodel-0.3.0.tar.gz" } ] }