Opened 18 years ago

Closed 18 years ago

Last modified 17 years ago

#1544 closed defect (fixed)

[patch] django-admin.py inspectdb shouldn't require dbname

Reported by: pb@… 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)

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

Download all attachments as: .zip

Change History (5)

by pb@…, 18 years ago

Attachment: inspectdb.patch added

comment:1 by Adrian Holovaty, 18 years ago

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?

comment:2 by pb@…, 18 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 pb@…, 18 years ago

Severity: normalminor
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 Adrian Holovaty, 18 years ago

Resolution: fixed
Status: newclosed

(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