Opened 14 years ago

Closed 13 years ago

#3070 closed enhancement (wontfix)

[patch] Execute prefixed and sorted files for initial SQL data

Reported by: Bastian Kleineidam <calvin@…> Owned by: nobody
Component: Core (Management commands) Version:
Severity: normal Keywords:
Cc: Triage Stage: Design decision needed
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no


I had the need to execute initial SQL statements in a certain order. This patch looks not only for $model.sql and $model.$dbwrapper.sql, but also for any filename that ends with one of those two patterns. Furthermore, the files are alphabetically sorted before execution.

With these two enhancements, it is for example possible to have a sorted SQL file list which is processed in alphabetical order:


Another feature is that all SQL commands are printed when the verbosity level is greater than two.

A downside (or for me, this is an upside ;) is that with the patch, all initial SQL commands are executed in one single transaction. Either all or none initial SQL commands for newly detected models get applied.

Attachments (1)

django_management_sql.diff (7.4 KB) - added by Bastian Kleineidam <calvin@…> 14 years ago.

Download all attachments as: .zip

Change History (4)

Changed 14 years ago by Bastian Kleineidam <calvin@…>

Attachment: django_management_sql.diff added

comment:1 Changed 13 years ago by Simon G. <dev@…>

Triage Stage: UnreviewedDesign decision needed

comment:2 Changed 13 years ago by calvin@…

It is nice to have sorted files, but I guess fixtures are the preferred way to get data into the database now.
If nobody really needs this, you can close my ticket.

comment:3 Changed 13 years ago by Russell Keith-Magee

Resolution: wontfix
Status: newclosed

Closed at the request of the original requester, coupled with the fact that the use case it covers is now covered by fixtures.

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