Skip to main content

Easier management of the bulk create/update/delete for Django

Project description

Bulk Manager Django

Easier management of the bulk create/update/delete for Django

Bulk Manager is a plugin for Django to facilitate the bulk features of database operations.

Features

  • Easy to use
  • Performance optimization

Advantages

  • Highly flexible
  • Lightweight
  • Open-source
  • Real use cases
  • Support & documentation

Authors

  • Rudy Fernandez

Install

The easiest way to install default_mutable using pip: pip install bulk-manager-django

Methods

Attribute Description
prepareCreate Add the object to the list
create Bulk create all the objects in the create list
set Change an object value
getValueFromMemory Access a specific value from an object if previously set
update Bulk update
prepareDelete Add the object to the list
delete Bulk delete
execute Perform all actions (create, update and delete) at once

prepareCreate

Argument Type Default Description
obj Model or list of Models Model or list of Models to update

create

Argument Type Default Description
listObj list [] List of strings of all Models to create. If empty, create all pending records

set

Argument Type Default Description
obj Model Object to update
attr list or str 'grandfather.father.attr' or ['grandfather', 'father', 'attr']
value Any Value to set

getValueFromMemory

| obj | Model | | Object to get the value from | | attr | str | | Attribute of the object | | default_value | Any | | Default value to return if not in memory | For every value updated with the method 'set' is stored in memory. 'getValueFromMemory' checks if the value has previously been updated.

update

Argument Type Default Description
listObj list [] List of strings of all Models to update. If empty, create all pending records

prepareDelete

Argument Type Default Description
obj Model Record to delete

delete

Argument Type Default Description
listObj list [] List of strings of all Models to delete. If empty, delete all pending records. Deletion occurs in the same order of the list

execute

Argument Type Default Description
create_order list [] List of strings of all Models to delete. If empty, create all pending records. Creation occurs in the same order of the list
delete_order list [] List of strings of all Models to delete. If empty, delete all pending records. Delation occurs in the same order of the list

Examples

from bulk_manager_django.BulkManager import BulkManager
BM = BulkManager()

BM.prepareCreate([
   DemoTable(
      name        = 'built-in create1',
      is_enabled  = True,
      insert_type = 'built-in',
   ),
   DemoTable(
      name        = 'built-in create2',
      is_enabled  = True,
      insert_type = 'built-in',
   ),
   DemoTable(
      name        = 'built-in create3',
      is_enabled  = True,
      insert_type = 'built-in',
   )
])

BM.create() # or BM.execute()

for record in DemoTable.objects.filter(insert_type = 'bulk-manager'):
      BM.set(record, 'description', 'updated description')
      
      BM.set(record, 'platform_name', 'updated platform_name')
      
      BM.set(record, 'is_enabled', randomBool())
      
BM.update() # or BM.execute()

for record in DemoTable.objects.filter(insert_type = 'bulk-manager'):
      BM.prepareDelete(record)
      
   

BM.delete(['DemoTable']) # or BM.delete() or BM.execute() or BM.execute(delete_order= ['DemoTable'])

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

bulk_manager_django-0.1.2.tar.gz (5.8 kB view details)

Uploaded Source

Built Distribution

bulk_manager_django-0.1.2-py3-none-any.whl (5.7 kB view details)

Uploaded Python 3

File details

Details for the file bulk_manager_django-0.1.2.tar.gz.

File metadata

  • Download URL: bulk_manager_django-0.1.2.tar.gz
  • Upload date:
  • Size: 5.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/34.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.63.0 importlib-metadata/4.11.3 keyring/23.5.0 rfc3986/1.5.0 colorama/0.4.4 CPython/3.8.0

File hashes

Hashes for bulk_manager_django-0.1.2.tar.gz
Algorithm Hash digest
SHA256 dd35955aaf41f3768bc8c98489750beadb5e1d795dbe2430ef8ea6cc99c13356
MD5 948cd73274230a304e814cfbf7d62cc5
BLAKE2b-256 034e4d6597add437a1f0efd1e108d444308849bd7ce760155004fe3a70172746

See more details on using hashes here.

File details

Details for the file bulk_manager_django-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: bulk_manager_django-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 5.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/34.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.63.0 importlib-metadata/4.11.3 keyring/23.5.0 rfc3986/1.5.0 colorama/0.4.4 CPython/3.8.0

File hashes

Hashes for bulk_manager_django-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 233f0e3c02fd5edf13f0579384c416aabf66675ba57f18957d93c89b2d1ae799
MD5 92581b4025355ba62fc5db005b7bb424
BLAKE2b-256 775c4e93cfce20c11a3f64636d911d485aaab9dc790a69ce3d822627dcf151ad

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page