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

made QuerySet.bulk_create() set pk on created model instances #198

Merged

Conversation

timgraham
Copy link
Collaborator

This covered by tests in Django's test suite that will no longer be skipped when can_return_rows_from_bulk_insert is set to True.

@timgraham timgraham force-pushed the can_return_rows_from_bulk_insert branch from bafa752 to 3786fa0 Compare December 12, 2024 18:36
Copy link
Collaborator

@aclark4life aclark4life left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, pk is set because returning_fields are always returned?

@timgraham timgraham force-pushed the can_return_rows_from_bulk_insert branch from 3786fa0 to 546554a Compare December 12, 2024 22:54
@timgraham
Copy link
Collaborator Author

Any field with db_returning = True will appear in returning_fields, namely AutoField (which ObjectIdAutoField inherits), or for databases that support it (not MongoDB), GeneratedField or fields with a database default.

@timgraham timgraham merged commit 546554a into mongodb-labs:main Dec 13, 2024
10 checks passed
@timgraham timgraham deleted the can_return_rows_from_bulk_insert branch December 13, 2024 00:28
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.

2 participants