Opened 5 years ago

Closed 4 years ago

Last modified 4 years ago

#16330 closed New feature (fixed)

dumpdata: filter output with given pimary keys

Reported by: Thomas Güttler Owned by: Kevin Brolly
Component: Core (Serialization) Version: 1.3
Severity: Normal Keywords: dumpdata
Cc: hv@…, riccardo.magliocchetti@… Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: yes UI/UX: no

Description

This patch adds the --pks option to "dumpdata". You can give a space seperated list
of primary keys. Only the given objects get dumped. Only usefull if you give a ModelName.

Attachments (3)

dumpdata-primary-keys.patch (3.7 KB) - added by Thomas Güttler 5 years ago.
dumpdata-primary-keys2.diff (4.0 KB) - added by rm_ 5 years ago.
Diffed against latest trunk, coding style cleanup, some code motion in dumpdata to follow how the other options are checked, some rewording of the help text
dumpdata-primary-keys3.diff (4.3 KB) - added by Bumyong Choi 4 years ago.

Download all attachments as: .zip

Change History (20)

Changed 5 years ago by Thomas Güttler

Attachment: dumpdata-primary-keys.patch added

comment:1 Changed 5 years ago by Thomas Güttler

Keywords: dumpdata added

comment:2 Changed 5 years ago by Thomas Güttler

Easy pickings: set

comment:3 Changed 5 years ago by Aymeric Augustin

Patch needs improvement: set
Triage Stage: UnreviewedDesign decision needed

Since it's a new feature, I think we need a core developer's approval.
=> DDN.

I think the help text could be improved, especially this part: Normally only usefull if you give a ModelName (besides the fact that the correct spelling is "useful"). Also, you must respect Django's coding standards, like spaces around = and ==, except for keyword arguments.
=> Patch needs improvement.

comment:4 Changed 5 years ago by Aymeric Augustin

Triage Stage: Design decision neededAccepted

#8429 was a duplicate. There isn't much info on that ticket.

Changed 5 years ago by rm_

Attachment: dumpdata-primary-keys2.diff added

Diffed against latest trunk, coding style cleanup, some code motion in dumpdata to follow how the other options are checked, some rewording of the help text

comment:5 Changed 5 years ago by rm_

Cc: riccardo.magliocchetti@… added

comment:6 Changed 4 years ago by Bumyong Choi

Owner: changed from nobody to Bumyong Choi

Changed 4 years ago by Bumyong Choi

Attachment: dumpdata-primary-keys3.diff added

comment:7 Changed 4 years ago by Bumyong Choi

Patch needs improvement: unset
Status: newassigned

Diffed against the latest trunk. Rewording of the help text: " This is mostly useful when dumping only a single model." -> "This option is applied to all apps/models."

https://code.djangoproject.com/attachment/ticket/16330/dumpdata-primary-keys3.diff

Version 1, edited 4 years ago by Bumyong Choi (previous) (next) (diff)

comment:8 Changed 4 years ago by Florian Apolloner

Needs documentation: set

comment:9 Changed 4 years ago by mehmetakyuz

Owner: changed from Bumyong Choi to mehmetakyuz

writing documentation during #django-sprint

comment:10 Changed 4 years ago by mehmetakyuz

Pull request with the addition of documentation

https://github.com/django/django/pull/755

comment:11 Changed 4 years ago by mehmetakyuz

Updated pull request that instead uses comma seperated string of pk's instead of space seperated. Sanity restored.
https://github.com/django/django/pull/767

comment:12 Changed 4 years ago by mehmetakyuz

Triage Stage: AcceptedReady for checkin

comment:13 Changed 4 years ago by Aymeric Augustin

Triage Stage: Ready for checkinAccepted

Please don't mark your own patches as RFC, have someone else review them. Thanks!

comment:14 Changed 4 years ago by Kevin Brolly

Owner: changed from mehmetakyuz to Kevin Brolly

Grabbing this ticket to fix the issues raised by jacobian in the pull request.

comment:15 Changed 4 years ago by Kevin Brolly

Needs documentation: unset

Pull request fixing issues raised by jacobian in previous pull request.

https://github.com/django/django/pull/1151

comment:16 Changed 4 years ago by Preston Holmes <preston@…>

Resolution: fixed
Status: assignedclosed

In 6786920fd8a1dfa43bba8333548c2496847298af:

Fixed #16330 -- added --pks option in dumpdata command

Thanks to guettli for the initial ticket and patch, with additional work
from mehmetakyuz and Kevin Brolly.

comment:17 Changed 4 years ago by Claude Paroz

See #20509 for current failure.

Note: See TracTickets for help on using tickets.
Back to Top