Re: [Django] #13528: db_table truncation is applied based on the properties of the default database

23 views
Skip to first unread message

Django

unread,
Apr 7, 2012, 1:39:59 PM4/7/12
to django-...@googlegroups.com
#13528: db_table truncation is applied based on the properties of the default
database
-------------------------------------+-------------------------------------
Reporter: russellm | Owner:
Type: Bug | andrewgodwin
Component: Database layer | Status: assigned
(models, ORM) | Version: 1.2-beta
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by akaariai):

Ive been thinking that model._meta should contain backend specific
sections. This should contain at least quoted db_table name and column
names. In addition to solving this problem such an arrangement should
speed up SQL generation. Quoting the table and column names can consume a
significant amount of time.

So, instead of doing model._meta.db_table you would do something like
model._meta[conn].db_table. However, this requires somewhat extensive
changes in the sql/query.py and sql/compiler.py, so I guess this has to
wait...

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

Django

unread,
Feb 8, 2013, 12:17:23 PM2/8/13
to django-...@googlegroups.com
#13528: db_table truncation is applied based on the properties of the default
database
-------------------------------------+-------------------------------------
Reporter: russellm | Owner:
Type: Bug | andrewgodwin
Component: Database layer | Status: assigned
(models, ORM) | Version: 1.2-beta
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 1 | Patch needs improvement: 0

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

* has_patch: 0 => 1
* needs_tests: 0 => 1


Comment:

Using router might be a solution, however I don't know if this does
negatively affect performance or not.

--
Ticket URL: <https://code.djangoproject.com/ticket/13528#comment:14>

Django

unread,
Dec 22, 2013, 1:39:12 PM12/22/13
to django-...@googlegroups.com
#13528: db_table truncation is applied based on the properties of the default
database
-------------------------------------+-------------------------------------
Reporter: russellm | Owner:
Type: Bug | andrewgodwin
Component: Database layer | Status: assigned
(models, ORM) | Version: 1.2-beta
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 1 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by anubhav9042):

claudep: In the diff you added:

{{{db = router.db_for_read(self.model)}}}
Option object doesn't have an attribute model

--
Ticket URL: <https://code.djangoproject.com/ticket/13528#comment:15>

Django

unread,
Dec 22, 2013, 3:34:00 PM12/22/13
to django-...@googlegroups.com
#13528: db_table truncation is applied based on the properties of the default
database
-------------------------------------+-------------------------------------
Reporter: russellm | Owner:
Type: Bug | andrewgodwin
Component: Database layer | Status: assigned
(models, ORM) | Version: 1.2-beta
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 1 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by anubhav9042):

claudep: Making self.model to self.concrete_model works fine.
Since this is related to #13711 also so I have used the changes shown in
your diff for fixing that.
Please see: https://github.com/django/django/pull/2102

--
Ticket URL: <https://code.djangoproject.com/ticket/13528#comment:16>

Django

unread,
Mar 7, 2014, 1:28:13 PM3/7/14
to django-...@googlegroups.com
#13528: db_table truncation is applied based on the properties of the default
database
-------------------------------------+-------------------------------------
Reporter: russellm | Owner:
Type: Bug | Status: new
Component: Database layer | Version: 1.2-beta
(models, ORM) | Resolution:
Severity: Normal | Triage Stage: Accepted
Keywords: | Needs documentation: 0
Has patch: 1 | Patch needs improvement: 0
Needs tests: 1 | UI/UX: 0
Easy pickings: 0 |
-------------------------------------+-------------------------------------
Changes (by andrewgodwin):

* owner: andrewgodwin =>
* status: assigned => new


--
Ticket URL: <https://code.djangoproject.com/ticket/13528#comment:17>

Django

unread,
May 18, 2014, 2:10:22 AM5/18/14
to django-...@googlegroups.com
#13528: db_table truncation is applied based on the properties of the default
database
-------------------------------------+-------------------------------------
Reporter: russellm | Owner:
Type: Bug | anubhav9042

Component: Database layer | Status: assigned
(models, ORM) | Version: 1.2-beta
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 1 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by anubhav9042):

* status: new => assigned
* owner: => anubhav9042


--
Ticket URL: <https://code.djangoproject.com/ticket/13528#comment:18>

Django

unread,
May 31, 2014, 11:14:34 AM5/31/14
to django-...@googlegroups.com
#13528: db_table truncation is applied based on the properties of the default
database
-------------------------------------+-------------------------------------
Reporter: russellm | Owner:
Type: Bug | anubhav9042
Component: Database layer | Status: assigned
(models, ORM) | Version: master

Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 1 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by anubhav9042):

* version: 1.2-beta => master


Comment:

As discussed with Florian on IRC, we should check for minimum length that
all available dbs allow and truncate accordingly.
PR: https://github.com/django/django/pull/2738

--
Ticket URL: <https://code.djangoproject.com/ticket/13528#comment:19>

Django

unread,
Jun 7, 2014, 2:20:12 PM6/7/14
to django-...@googlegroups.com
#13528: db_table truncation is applied based on the properties of the default
database
-------------------------------------+-------------------------------------
Reporter: russellm | Owner:
Type: Bug | anubhav9042
Component: Database layer | Status: assigned
(models, ORM) | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 1

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

* needs_better_patch: 0 => 1
* needs_tests: 1 => 0


Comment:

I don't think the approach of the latest PR is good. Let's try
implementing what Andrew suggested in comment 5 of this ticket.

--
Ticket URL: <https://code.djangoproject.com/ticket/13528#comment:20>

Django

unread,
Jun 8, 2014, 1:45:50 AM6/8/14
to django-...@googlegroups.com
#13528: db_table truncation is applied based on the properties of the default
database
-------------------------------------+-------------------------------------
Reporter: russellm | Owner:
Type: Bug | anubhav9042
Component: Database layer | Status: assigned
(models, ORM) | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 1
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by loic84):

* cc: loic84 (added)


--
Ticket URL: <https://code.djangoproject.com/ticket/13528#comment:21>

Django

unread,
Jun 8, 2014, 2:43:12 PM6/8/14
to django-...@googlegroups.com
#13528: db_table truncation is applied based on the properties of the default
database
-------------------------------------+-------------------------------------
Reporter: russellm | Owner:
Type: Bug | anubhav9042
Component: Database layer | Status: assigned
(models, ORM) | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 1
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by anubhav9042):

Replying to [comment:20 timo]:


> I don't think the approach of the latest PR is good. Let's try
implementing what Andrew suggested in comment 5 of this ticket.

I tried to implement the above, I think that it is infeasible, atleast at
the moment for the following reason:
- There are many places for eg. as in query creation where `db_table` is
used but there is no knowledge of `alias` or `connection` in order to call
`get_db_table`. Even if try to increase the function parameters it would
be very hacky to continue all the way up the function calls until an
`alias` is found and pass it down all the way where it is needed.
- In the backends there is no alias used so we don't know using the
connection to call this function will be correct or not.
- There are many places where still `connection` is used instead of
`connections[alias]` so that might continue to create similar multi-db
problems as the above.

I discussed this issue a little with Loic and this is what he suggested
that we can note down where and why it is possible to change the suggested
behaviour and where all the alias is not used and should be so that we can
move on from this and try to fix that bigger problem instead of this one
and that might take considerable amount of time.

--
Ticket URL: <https://code.djangoproject.com/ticket/13528#comment:22>

Django

unread,
Dec 12, 2014, 1:13:18 PM12/12/14
to django-...@googlegroups.com
#13528: db_table truncation is applied based on the properties of the default
database
-------------------------------------+-------------------------------------
Reporter: russellm | Owner:
Type: Bug | Status: new
Component: Database layer | Version: master

(models, ORM) | Resolution:
Severity: Normal | Triage Stage: Accepted
Keywords: | Needs documentation: 0
Has patch: 1 | Patch needs improvement: 1
Needs tests: 0 | UI/UX: 0
Easy pickings: 0 |
-------------------------------------+-------------------------------------
Changes (by timgraham):

* owner: anubhav9042 =>


* status: assigned => new


--
Ticket URL: <https://code.djangoproject.com/ticket/13528#comment:23>

Reply all
Reply to author
Forward
0 new messages