Django

Code

Ticket #1544 (closed: fixed)

Opened 3 years ago

Last modified 2 years ago

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

Reported by: pb@e-scribe.com Assigned to: adrian
Milestone: Component: django-admin.py
Version: magic-removal Keywords:
Cc: Triage Stage: Unreviewed
Has patch: 1 Needs documentation: 0
Needs tests: 0 Patch needs improvement: 0

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

inspectdb.patch (1.8 kB) - added by pb@e-scribe.com on 03/27/06 10:32:41.

Change History

03/27/06 10:32:41 changed by pb@e-scribe.com

  • attachment inspectdb.patch added.

03/27/06 10:35:27 changed by adrian

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?

03/27/06 11:03:05 changed by pb@e-scribe.com

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...

04/17/06 09:29:38 changed by pb@e-scribe.com

  • severity changed from normal to minor.
  • summary changed from django-admin.py inspectdb shouldn't require dbname to [patch] django-admin.py inspectdb shouldn't require dbname.

Updating summary to reflect presence of patch

04/17/06 16:02:32 changed by adrian

  • status changed from new to closed.
  • resolution set to fixed.

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


Add/Change #1544 ([patch] django-admin.py inspectdb shouldn't require dbname)




Change Properties
Action