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

2019-06-08 Thread Django
#6344: Refactored manage.py inspectdb
-+-
 Reporter:  Daniel Pope   |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: 
Django 
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 django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
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.


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

2015-06-30 Thread Django
#6344: Refactored manage.py inspectdb
-+-
 Reporter:  Daniel Pope   |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: 
Django 
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 django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/095.3df92c645471b5eb9fd4cdb757f98d32%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


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

2014-02-08 Thread Django
#6344: Refactored manage.py inspectdb
-+-
 Reporter:  Daniel Pope   |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: 
Django 
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 django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/095.8c5fc667df2ca8a2eb9fa3c58ae15392%40djangoproject.com.
For more options, visit https://groups.google.com/groups/opt_out.


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

2011-07-31 Thread Django
#6344: Refactored manage.py inspectdb
-+-
   Reporter:  Daniel |  Owner:  nobody
  Pope| 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: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-updates@googlegroups.com.
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en.



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

2011-04-01 Thread Django
#6344: Refactored manage.py inspectdb
-+-
   Reporter:  Daniel |Owner:  nobody
  Pope|   Status:  new
   Type:  Bug|Component:  Core (Management
  Milestone: |  commands)
Version:  SVN| Severity:  Normal
 Resolution: | Keywords:
   Triage Stage:  Accepted   |Has patch:  1
Needs documentation:  0  |  Needs tests:  1
Patch needs improvement:  1  |
-+-
Changes (by julien):

 * type:   => Bug
 * severity:   => Normal
 * needs_tests:  0 => 1


Comment:

 2 years later, no doubt this patch needs an update. It'd also be great if
 someone could check whether the issues reported here still exist.

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-updates@googlegroups.com.
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en.



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

2008-11-06 Thread Django
#6344: Refactored manage.py inspectdb
+---
  Reporter:  Daniel Pope <[EMAIL PROTECTED]>  | Owner:  nobody
Status:  new| Milestone:

 Component:  django-admin.py inspectdb  |   Version:  
SVN   
Resolution: |  Keywords:

 Stage:  Accepted   | Has_patch:  1 

Needs_docs:  0  |   Needs_tests:  0 

Needs_better_patch:  1  |  
+---
Comment (by maubp):

 There's a bug in Daniel's patch, inspectdb_refactor.diff (13.1 kB) dated
 01/08/08.


 {{{
 146 def __str__(self):
 147 s='class %s(models.Model):\n' % self.model_name
 148
 149 keys, rels, ids, other=self.group_fields()
 150 if not keys:
 151 s+='# Warning: this model needs a field
 with primary_key=True\n\n'
 152
 153 for f in keys:
 154 s+='%s\n'%self._field_as_str(f)
 155 if keys:
 156 s+='\n'
 157
 158 for f in ids:
 159 s+='%s\n'%self._field_as_str(f)
 160 if ids:
 161 s+='\n'
 162
 163 for r in rels:
 164 s+='%s\n'%self._rel_as_str(f)
 165 if rels:
 166 s+='\n'
 167
 168 for f in other:
 169 s+='%s\n'%self._field_as_str(f)
 170 if other:
 171 s+='\n'
 }}}


 Line 163, should be "for f in rels" not "for r in rels"

 On a style point, I would have written this section more like:


 {{{
 for group in [keys, ids, rels, other] :
 if group :
 s+= "\n".join(['%s'%self._field_as_str(f) for f in ids)]) +
 "\n"
 }}}


 Similarly for the Database object's __str__ method,

 {{{

 class Database(object):
 ...
 def __str__(self):
 return "\n\n".join([str(m) for m in self.models.values()])
 }}}


 But this is subjective and I don't know which follows the Django coding
 style best.


 

 I've being trying the inspectdb tool on a MySQL database, and particularly
 liked three bits of this patch:
 * automatic sorting of the models/tables (a very tedious manual task)
 * db_column is always specified (I'm already familiar with our schema,
 so I want to see the original column names)
 * warning comment if no primary_key is detected (very helpful for
 diagnostics, see also ticket 373)

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-updates@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en
-~--~~~~--~~--~--~---



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

2008-09-09 Thread Django
#6344: Refactored manage.py inspectdb
+---
  Reporter:  Daniel Pope <[EMAIL PROTECTED]>  | Owner:  nobody
Status:  new| Milestone:

 Component:  django-admin.py inspectdb  |   Version:  
SVN   
Resolution: |  Keywords:

 Stage:  Accepted   | Has_patch:  1 

Needs_docs:  0  |   Needs_tests:  0 

Needs_better_patch:  1  |  
+---
Changes (by adrian):

  * component:  Tools => django-admin.py inspectdb

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-updates@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en
-~--~~~~--~~--~--~---