Code

Opened 3 years ago

Closed 14 months ago

Last modified 14 months ago

#16330 closed New feature (fixed)

dumpdata: filter output with given pimary keys

Reported by: guettli Owned by: kevinbrolly
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 guettli 3 years ago.
dumpdata-primary-keys2.diff (4.0 KB) - added by rm_ 3 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 bchoi 22 months ago.

Download all attachments as: .zip

Change History (20)

Changed 3 years ago by guettli

comment:1 Changed 3 years ago by guettli

  • Keywords dumpdata added
  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset

comment:2 Changed 3 years ago by guettli

  • Easy pickings set

comment:3 Changed 3 years ago by aaugustin

  • Patch needs improvement set
  • Triage Stage changed from Unreviewed to Design 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 3 years ago by aaugustin

  • Triage Stage changed from Design decision needed to Accepted

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

Changed 3 years ago by rm_

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

  • Cc riccardo.magliocchetti@… added

comment:6 Changed 22 months ago by bchoi

  • Owner changed from nobody to bchoi

Changed 22 months ago by bchoi

comment:7 Changed 22 months ago by bchoi

  • Patch needs improvement unset
  • Status changed from new to assigned

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 22 months ago by bchoi (previous) (diff)

comment:8 Changed 19 months ago by apollo13

  • Needs documentation set

comment:9 Changed 17 months ago by mehmetakyuz

  • Owner changed from bchoi to mehmetakyuz

writing documentation during #django-sprint

comment:10 Changed 17 months ago by mehmetakyuz

Pull request with the addition of documentation

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

comment:11 Changed 17 months 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 17 months ago by mehmetakyuz

  • Triage Stage changed from Accepted to Ready for checkin

comment:13 Changed 17 months ago by aaugustin

  • Triage Stage changed from Ready for checkin to Accepted

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

comment:14 Changed 14 months ago by kevinbrolly

  • Owner changed from mehmetakyuz to kevinbrolly

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

comment:15 Changed 14 months ago by kevinbrolly

  • Needs documentation unset

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

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

comment:16 Changed 14 months ago by Preston Holmes <preston@…>

  • Resolution set to fixed
  • Status changed from assigned to closed

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 14 months ago by claudep

See #20509 for current failure.

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.