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.
* 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>
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>
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>
* owner: andrewgodwin =>
* status: assigned => new
--
Ticket URL: <https://code.djangoproject.com/ticket/13528#comment:17>
* status: new => assigned
* owner: => anubhav9042
--
Ticket URL: <https://code.djangoproject.com/ticket/13528#comment:18>
* 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>
* 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>
* cc: loic84 (added)
--
Ticket URL: <https://code.djangoproject.com/ticket/13528#comment:21>
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>
* owner: anubhav9042 =>
* status: assigned => new
--
Ticket URL: <https://code.djangoproject.com/ticket/13528#comment:23>