Opened 14 years ago

Closed 12 years ago

Last modified 12 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 14 years ago.
dumpdata-primary-keys2.diff (4.0 KB ) - added by rm_ 13 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 12 years ago.

Download all attachments as: .zip

Change History (20)

by Thomas Güttler, 14 years ago

Attachment: dumpdata-primary-keys.patch added

comment:1 by Thomas Güttler, 14 years ago

Keywords: dumpdata added

comment:2 by Thomas Güttler, 14 years ago

Easy pickings: set

comment:3 by Aymeric Augustin, 14 years ago

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 by Aymeric Augustin, 13 years ago

Triage Stage: Design decision neededAccepted

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

by rm_, 13 years ago

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 by rm_, 13 years ago

Cc: riccardo.magliocchetti@… added

comment:6 by Bumyong Choi, 12 years ago

Owner: changed from nobody to Bumyong Choi

by Bumyong Choi, 12 years ago

Attachment: dumpdata-primary-keys3.diff added

comment:7 by Bumyong Choi, 12 years ago

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

PRed here: https://github.com/django/django/pull/344

Last edited 12 years ago by Bumyong Choi (previous) (diff)

comment:8 by Florian Apolloner, 12 years ago

Needs documentation: set

comment:9 by mehmetakyuz, 12 years ago

Owner: changed from Bumyong Choi to mehmetakyuz

writing documentation during #django-sprint

comment:10 by mehmetakyuz, 12 years ago

Pull request with the addition of documentation

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

comment:11 by mehmetakyuz, 12 years ago

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 by mehmetakyuz, 12 years ago

Triage Stage: AcceptedReady for checkin

comment:13 by Aymeric Augustin, 12 years ago

Triage Stage: Ready for checkinAccepted

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

comment:14 by Kevin Brolly, 12 years ago

Owner: changed from mehmetakyuz to Kevin Brolly

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

comment:15 by Kevin Brolly, 12 years ago

Needs documentation: unset

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

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

comment:16 by Preston Holmes <preston@…>, 12 years ago

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 by Claude Paroz, 12 years ago

See #20509 for current failure.

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