#1544 closed defect (fixed)
[patch] django-admin.py inspectdb shouldn't require dbname
Reported by: | Owned by: | Adrian Holovaty | |
---|---|---|---|
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: | no | UI/UX: | no |
Description
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 settings.py 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 settings.py 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)
Change History (5)
by , 19 years ago
Attachment: | inspectdb.patch added |
---|
comment:1 by , 19 years ago
comment:2 by , 19 years ago
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 settings.py. Passing the params on the commandline would be a minor DRY violation in my case as I'd then need to put them into settings.py anyway.
I don't really have a sense of how other people use it...
comment:3 by , 19 years ago
Severity: | normal → minor |
---|---|
Summary: | django-admin.py inspectdb shouldn't require dbname → [patch] django-admin.py inspectdb shouldn't require dbname |
Updating summary to reflect presence of patch
comment:4 by , 19 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
Alternatively, we could remove the requirement on settings.py 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?