Opened 10 years ago

Closed 10 years ago

Last modified 10 years ago

#1544 closed defect (fixed)

[patch] inspectdb shouldn't require dbname

Reported by: pb@… Owned by: adrian
Component: Core (Management commands) Version: magic-removal
Severity: minor Keywords:
Cc: Triage Stage: Unreviewed
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:


Currently the "inspectdb" command requires a dbname argument, while still using the backend type, username, and password defined in DJANGO_SETTINGS_MODULE. It might as well pull the dbname from there too. Allowing the dbname as a command-line parameter has the potential to create confusion by obscuring the dependency on and doesn't really save the user any work in most cases.

(I can imagine some cases where the current behavior would be handy -- SQLite, or multiple DBs that happen to share access -- but I think in most cases the user will need to edit before running inspectdb anyway.)

Attached is a patch that removes the required argument.

I'm setting this ticket's version to magic-removal since that's the branch my patch is on.

Attachments (1)

inspectdb.patch (1.8 KB) - added by pb@… 10 years ago.

Download all attachments as: .zip

Change History (5)

Changed 10 years ago by pb@…

comment:1 Changed 10 years ago by adrian

Alternatively, we could remove the requirement on entirely, and require that inspectdb be passed the backend, username, password and database name. I'm not sure which solution is better. Arguments for both sides?

comment:2 Changed 10 years ago by pb@…

One metric you could use is how often the inspected db becomes the actual live DB for the project. For me, that's almost always the case, so it makes sense to put the information into Passing the params on the commandline would be a minor DRY violation in my case as I'd then need to put them into anyway.

I don't really have a sense of how other people use it...

comment:3 Changed 10 years ago by pb@…

  • Severity changed from normal to minor
  • Summary changed from inspectdb shouldn't require dbname to [patch] inspectdb shouldn't require dbname

Updating summary to reflect presence of patch

comment:4 Changed 10 years ago by adrian

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

(In [2711]) magic-removal: Fixed #1544 -- Changed 'inspectdb' to use database name from DATABASE_NAME setting instead of command line. Thanks, pb

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