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

More efficient utils.chunk #1613

Merged
merged 4 commits into from
May 14, 2024

Conversation

Abdeldjalil-H
Copy link
Contributor

@Abdeldjalil-H Abdeldjalil-H commented May 13, 2024

The utils.chunk function from tortoise.utils is converting instances into list. I think it is better to not load all the list at one time but rather in chunks as the name suggested. This is useful in cases when the user passes a generator instead of list especially for large datasets.

Checklist:

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have added the changelog accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

- remove converting objects iterable to list in bulk_create
- change chunk method to return iterables lazy
@Abdeldjalil-H Abdeldjalil-H changed the title More efficient bulk operations More efficient utils.chunk May 13, 2024
@coveralls
Copy link

Pull Request Test Coverage Report for Build 9058250244

Details

  • 10 of 10 (100.0%) changed or added relevant lines in 1 file are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.01%) to 87.943%

Totals Coverage Status
Change from base Build 9028420328: 0.01%
Covered Lines: 5776
Relevant Lines: 6472

💛 - Coveralls

@Abdeldjalil-H
Copy link
Contributor Author

It seems that the failing tests have nothing to do with the changes made, because the changed part is not being called at all for the failed test case. Moreover, it passes the first time, then when I changed contrubitors file it fails!

@abondar abondar merged commit 96b999e into tortoise:develop May 14, 2024
7 checks passed
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

Successfully merging this pull request may close these issues.

None yet

3 participants