Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expose control over Django bulk_save option #46

Closed
ShaheedHaque opened this issue Dec 28, 2017 · 6 comments
Closed

Expose control over Django bulk_save option #46

ShaheedHaque opened this issue Dec 28, 2017 · 6 comments

Comments

@ShaheedHaque
Copy link

@ShaheedHaque ShaheedHaque commented Dec 28, 2017

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.

@chfw chfw closed this in eddda91 Jan 10, 2018
@chfw
Copy link
Member

@chfw chfw commented Jan 10, 2018

I am sorry for the delay. Please try it. I have chosen the first suggestion. Will release it soon.

@ShaheedHaque
Copy link
Author

@ShaheedHaque ShaheedHaque commented Jan 10, 2018

chfw added a commit to pyexcel/pyexcel that referenced this issue Jan 11, 2018
chfw added a commit to pyexcel-webwares/django-excel that referenced this issue Jan 11, 2018
@chfw
Copy link
Member

@chfw chfw commented Jan 11, 2018

please take latest pyexcel, pyexcel-io and django-excel.

chfw added a commit to pyexcel/pyexcel that referenced this issue Jan 11, 2018
@ShaheedHaque
Copy link
Author

@ShaheedHaque ShaheedHaque commented Jan 12, 2018

I don't see a new package for django-excel? Pypi still seems to be on 0.0.9 which I believe predates the fix. (I do see pyexcel has been bumped to 0.5.7 and pyexcel-io to 0.5.6). Did the push of 0.0.10 to Pypi fail?

@chfw
Copy link
Member

@chfw chfw commented Jan 12, 2018

Hey, my apologies. I forgot to publish django-excel v0.0.10 to pypi last night. now it is there.

@ShaheedHaque
Copy link
Author

@ShaheedHaque ShaheedHaque commented Jan 13, 2018

Thanks, that seems to work nicely.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.