Skip to main content

Demo batchcreate library

Project description

Batchcreator takes an array of records as input and splits it into suitably sized batches of records which can be further processed or passed to any other system/s.

Quick start:

1.Install:

$ pip install batchcreate

2.Import BatchCreator iterator class and instantiate it. You can use below parameters to define output batch limits. These parameters are optional. If neither of these parameters is specified then the default values will be used. The default limits as :

  • max_record_size=1MB

    The maximum size limit for a record in the output batch. Any record with larger size than this will be skipped from batching.

  • max_batch_size=5MB

    The maximum size limit for a batch.

  • max_batch_num_records=500

    The maximum number of records limit for a batch. BatchCreator will put maximum these many records per batch provided batch size satisfies the limit.

from batchcreate import BatchCreator

batches = BatchCreator(records,
                       max_record_size=60,
                       max_batch_size=200,
                       max_batch_num_records=4)

3.The iterable BatchCreator object can give suitable batches as needed on iteration. The BatchCreator object can be used in a regular 'for' loop.

for batch in batches:
    print(batch) #batch processing here
    print('\n')

OR

batchItr = iter(batches)
print(next(batchItr)) #batch processing here

4.BatchCreator can return the list of all the batches as well.

batches = BatchCreator(records).batches()

Docs:

Library available at : batchcreate

Documentation at : Batchcreate Documentation

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

batchcreate-0.1.5.tar.gz (3.1 kB view details)

Uploaded Source

Built Distribution

batchcreate-0.1.5-py3-none-any.whl (3.7 kB view details)

Uploaded Python 3

File details

Details for the file batchcreate-0.1.5.tar.gz.

File metadata

  • Download URL: batchcreate-0.1.5.tar.gz
  • Upload date:
  • Size: 3.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.1

File hashes

Hashes for batchcreate-0.1.5.tar.gz
Algorithm Hash digest
SHA256 6565ed9609b5e59b46662a066a8388a88c8b0599de28d8cc61e2b9e8f359f479
MD5 04e0732b32496a21fefdf5094f508728
BLAKE2b-256 02e78221cccccf6b3bc1eef9d15dac4e90ac9504553d4c1ea8f69caa9aef4424

See more details on using hashes here.

File details

Details for the file batchcreate-0.1.5-py3-none-any.whl.

File metadata

  • Download URL: batchcreate-0.1.5-py3-none-any.whl
  • Upload date:
  • Size: 3.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.1

File hashes

Hashes for batchcreate-0.1.5-py3-none-any.whl
Algorithm Hash digest
SHA256 f01518b1b7fe21d907d2ba3d95fea08a56ac9f6c95bed46b20a0017565b2a3c9
MD5 fbcf5e16c03145d6055e8ded4d60b67a
BLAKE2b-256 082bf5372202977cc02d9e8b98c08fe9f8ab32eb69ba121b7762b4410527fd95

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