Re: [Django] #6344: Refactored manage.py inspectdb

16 views
Skip to first unread message

Django

unread,
Jul 31, 2011, 6:06:25 PM7/31/11
to django-...@googlegroups.com
#6344: Refactored manage.py inspectdb
-------------------------------------+-------------------------------------
Reporter: Daniel | Owner: nobody
Pope <dan@…> | Status: new
Type: Bug | Component: Core (Management
Milestone: | commands)
Version: SVN | Severity: Normal
Resolution: | Keywords: inspectdb
Triage Stage: Accepted | Has patch: 1
Needs documentation: 0 | Needs tests: 1
Patch needs improvement: 1 | Easy pickings: 0
UI/UX: 0 |
-------------------------------------+-------------------------------------
Changes (by ramiro):

* keywords: => inspectdb
* ui_ux: => 0
* easy: => 0


--
Ticket URL: <https://code.djangoproject.com/ticket/6344#comment:8>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Feb 8, 2014, 11:12:10 AM2/8/14
to django-...@googlegroups.com
#6344: Refactored manage.py inspectdb
-------------------------------------+-------------------------------------
Reporter: Daniel Pope <dan@…> | Owner: nobody
Type: Bug | Status: new
Component: Core (Management | Version: master
commands) | Resolution:
Severity: Normal | Triage Stage: Accepted
Keywords: inspectdb | Needs documentation: 0
Has patch: 1 | Patch needs improvement: 1
Needs tests: 1 | UI/UX: 0
Easy pickings: 0 |
-------------------------------------+-------------------------------------

Comment (by WoLpH):

So... it's been 6 and a half years now, any progress on this?

After trying the inspectdb command I still notice a few issues that would
be great to have fixed. For example the field `printableStyleTemplateId`
should be named `printable_style_template_id` instead of
`printablestyletemplateid`. Or maybe even `printable_style_template`, but
something smarter at least :)

--
Ticket URL: <https://code.djangoproject.com/ticket/6344#comment:9>

Django

unread,
Jun 30, 2015, 12:47:39 PM6/30/15
to django-...@googlegroups.com
#6344: Refactored manage.py inspectdb
-------------------------------------+-------------------------------------
Reporter: Daniel Pope <dan@…> | Owner: nobody
Type: Bug | Status: closed

Component: Core (Management | Version: master
commands) |
Severity: Normal | Resolution: wontfix

Keywords: inspectdb | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 1 | Patch needs improvement: 1

Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by claudep):

* status: new => closed
* resolution: => wontfix


Comment:

Things have changed a lot since that report. I'm closing it now, but that
doesn't mean the patch didn't contain interesting ideas. If anyone still
want to suggest improvements, please open a new ticket with an updated
patch.

--
Ticket URL: <https://code.djangoproject.com/ticket/6344#comment:10>

Django

unread,
Jun 8, 2019, 6:20:23 AM6/8/19
to django-...@googlegroups.com
#6344: Refactored manage.py inspectdb
-------------------------------------+-------------------------------------
Reporter: Daniel Pope <dan@…> | Owner: nobody
Type: Bug | Status: closed
Component: Core (Management | Version: master
commands) |
Severity: Normal | Resolution: wontfix
Keywords: inspectdb | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 1 | Patch needs improvement: 1
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by sur0g):

Although a lot of thing have changed, inspectdb still lacks normal column
naming as of 2.2 version. I've made a small fix for this, but things
remain unchanged in master repo of course.

Original table:
{{{
`idbalance_min` INT(11) NOT NULL,
`goods_GoodID` INT(11) NOT NULL,
`clients_ClientID` INT(11) NOT NULL,
`BalanceMinM` DECIMAL(10,0) NULL DEFAULT NULL,
`BalanceMinA` DECIMAL(10,0) NULL DEFAULT NULL,
`QtyPeriod` DECIMAL(10,0) NULL DEFAULT NULL,
`AVG` DECIMAL(10,0) NULL DEFAULT NULL,
`STD` DECIMAL(10,0) NULL DEFAULT NULL,
}}}

Resulting weird names:
{{{
idbalance_min = models.IntegerField(...)
goods_goodid = models.ForeignKey(...)
clients_clientid = models.ForeignKey(...)
balanceminm = models.DecimalField(...)
balancemina = models.DecimalField(...)
qtyperiod = models.DecimalField(...)
avg = models.DecimalField(...)
std = models.DecimalField(...)
}}}

Fields after a small patch:
{{{
idbalance_min = models.IntegerField(...)
goods_good = models.ForeignKey(...)
clients_client = models.ForeignKey(...)
balance_min_m = models.DecimalField(...)
balance_min_a = models.DecimalField(...)
qty_period = models.DecimalField(...)
avg = models.DecimalField(...)
std = models.DecimalField(...)
}}}

A few notes here:
1. Trailing ID is trimmed for the FK
2. camelCase & PascalCase are handled properly (snake_case)

Should I contribute?

--
Ticket URL: <https://code.djangoproject.com/ticket/6344#comment:11>

Reply all
Reply to author
Forward
0 new messages