Which tests?

modeltests/test_client/ClientTest.test_session_modifying_view returns ok and
after that everything stops... I have to kill the bash session.

>Are you running MySQL? There are some known test failures due to
>problems in the way MySQL handles row-level integrity.

One of my databases is MySQL, but the tests are all running on Postgres

>Hrm... my gut reaction is that the model description shouldn't know it
>is separated across databases; this is a deployment issue, so it
>wouldn't be good to hard code deployment into the model.

That's my feeling as well. I'm trying to keep my mitts off the existing code
as much as possible though, I guess one other option would be a property on
ForeignKey that it could set on initialization by looking at it's
rel.to._default_manager.connection  and making sure it's the same as the
class the FK is defined on?

>The queryset is (hopefully) about to undergo a bit of a refactor; so:
>
>1) Don't base too much of your changes on massive reworkings of query.py
>2) If you come across any refactorings that would be useful -
>especially in relation to writing custom fields, etc - make sure you
>make them known.

The parts I have in mind that would most need to change are probably
lookup_inner. I'll be looking to intercept the query at the point where a __
indicates a change of database and construct a select that looks more like
this:
  SELECT [columns,] from first_table where pk in (list_of_pk_values)
The list_of_pk_values will have to be generated by running the part of the
query after the __ in a separate query on the related database.

So these classes:
class ThisDBModel(models.model):
    ....

class OtherDBModel(models.model):
    ....
    lookup_field = models.CharField(..)
    firstdb_class = models.ForeignKey(ThisDBModel, related_name='otherfk')


And this query;
ThisDBModel.objects.filter(otherfk__lookup_field='whatever')

Would end up as:
  list_of_fk_values = SELECT firstdb_class_id FROM otherdbmodel WHERE
lookup_field = 'whatever';  #run on the other db
and:
  final_query =  SELECT * from thisdbmodel WHERE pk_column in
(list_of_fk_values);  #run on the main db

What do you think?

-- 
Regards,
Ben Ford
[EMAIL PROTECTED]
+628111880346

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to