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

Add more efficient way to export all records in a very large table #37

Open
kevindice opened this issue Mar 31, 2021 · 3 comments
Open

Comments

@kevindice
Copy link

Say I have a table with 2.5 million rows - the way this library works is that it sends a list of primary keys of all objects to export in the job-creation POST request. For very large sets of objects, uploading megabytes of primary keys can be quite slow or even run up against POST request body-size limits or other misc edge cases.

So, I think it could be useful to efficiently handle the special case of exporting everything.

Perhaps this looks like one of the django-admin gray action buttons w/ a confirmation page which creates the job.

Changes likely required:

  • possible modification to the export job model to represent "all"
  • adding a confirmation view page for exporting all
  • adding a django admin mixin to add the grey action button
  • docs update

Happy to send a PR if you think this is a good addition.

@timthelion
Copy link
Member

OK, seems reasonable. I'm not sure if it's a good idea to make things so final in the design that there would be a separate code path just for loading all. I wonder what the security implications would be if we were to make it so if "queryset" https://github.com/auto-mat/django-import-export-celery/blob/master/import_export_celery/models/exportjob.py#L80 is a json dict rather than a json list, it is passed as a set of **kwargs to .filter(). That way saving an empty json dict {} to queryset would export all entries. This would be better because in the future people could use this for all sorts of fancy pants shinanigans.

@timthelion
Copy link
Member

We actually need this too. Are you going to make a try at this or do I need to do it?

@timthelion
Copy link
Member

timthelion commented May 20, 2021

Can I have a vote @kevindice @PetrKudy @Goldziher on the best solution to this? Would you be happy with #43 ?

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

No branches or pull requests

2 participants