Skip to content

Expose control over Django bulk_save option #46

@ShaheedHaque

Description

@ShaheedHaque

I'm running into an issue with Django's QuerySet.bulk_create() on multi-table inheritance which might be addressed in some cases. The use of this feature is controlled using the bulk_save option on pyexcel_io.database.importers.django.DjangoModelWriter...however, this is not exposed by pyexcel_io.database.importers.django.DjangoBookWriter:

        sheet_writer = DjangoModelWriter(
           self.__importer, model,
           batch_size=self._keywords.get('batch_size', None))

A simple patch to address this would be to change that to:

        sheet_writer = DjangoModelWriter(
           self.__importer, model,
           batch_size=self._keywords.get('batch_size', None),
           bulk_save=self._keywords.get('bulk_save', None))

or (unless there is some reason to limit what is passed?) possibly even:

        sheet_writer = DjangoModelWriter(
           self.__importer, model, **self._keywords)

Higher up, the ability to specify bulk_save is present in pyexcel.internal.core.save_sheet and save_book but is not exposed by pyexcel.internal.meta.BookMeta.save_to_django_models. This would need to be trivially addressed too.

FWIW, I'm presently using pyexcel-io 0.5.4, but I see that master (as above) also currently has this issue.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions