Code

Opened 4 years ago

Last modified 16 months ago

#13680 new Cleanup/optimization

loaddata should issue a warning when attempting to load data using an unknown serialization format even when it is unspecified

Reported by: stevecrozz@… Owned by: nobody
Component: Core (Serialization) Version: master
Severity: Normal Keywords:
Cc: Triage Stage: Accepted
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

"loaddata" will issue a warning when you specify the filename and extension of the fixtures (in an unknown format) you want to load as seen in the following example:

./manage.py loaddata myapp/fixtures/initial_data.yaml
Problem installing fixture 'myapp/fixtures/initial_data': yaml is not a known serialization format.

"loaddata" has a less helpful message when you attempt to load data in an unknown format without specifying the file extension (the way syncdb does):

./manage.py loaddata myapp/fixtures/initial_data
No fixtures found.

When the file myapp/fixtures/initial_data.yaml exists, and pyyaml is not installed, the warning message should be the same whether or not you specify the file extension. I'd argue that anyone attempting to load database fixtures by name (sans extension) when a file exists with the same name would want to see this kind of warning. Some applications rely on initial_data fixtures and any user who issues ./manage syncdb and expects initial_data to load automatically could be frustrated if they fail to notice the 'No fixtures found' message. A warning is more appropriate in this instance.

Attachments (0)

Change History (6)

comment:1 Changed 4 years ago by Alex

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Triage Stage changed from Unreviewed to Accepted

comment:2 Changed 4 years ago by stevecrozz@…

I took a look at how loaddata processes fixtures and it appears that it builds a list of every possible combination of serialization and compression format then checks the filesystem for each one.

In order to solve this issue, we'll need to either have a secondary filesystem search for files that start with the specified fixture_labels, or we'll need to change the way loaddata works by first examining the filesystem for matches and then determining if suitable compression/serialization support exists. If a core developer would like to give me a hint as to which solution fits best, I will try my hand at a patch.

comment:3 Changed 3 years ago by julien

  • Severity set to Normal
  • Type set to Cleanup/optimization

comment:4 Changed 2 years ago by aaugustin

  • UI/UX unset

Change UI/UX from NULL to False.

comment:5 Changed 2 years ago by aaugustin

  • Easy pickings unset

Change Easy pickings from NULL to False.

comment:6 Changed 16 months ago by aaugustin

  • Component changed from Core (Other) to Core (Serialization)

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as new
The owner will be changed from nobody to anonymous. Next status will be 'assigned'
as The resolution will be set. Next status will be 'closed'
Author


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

 
Note: See TracTickets for help on using tickets.