#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>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/095.bcca410016bd023ba7e6c0b99841a64e%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.