#14068: Fixture loading issue with multi database setting
---------------------------+------------------------------------------------
 Reporter:  linovia        |       Owner:  nobody    
   Status:  new            |   Milestone:            
Component:  Uncategorized  |     Version:  1.2       
 Keywords:                 |       Stage:  Unreviewed
Has_patch:  0              |  
---------------------------+------------------------------------------------
 Hi there,

 Here is another issue with multi database setting and tests about fixture
 loading.
 I have a setup with one legacy database and one dedicated to django.

 In order to pass my tests, I load 2 fixture files. One is some
 administrative data for every test case and relating only to the django
 dedicated DB. The second fixture file is about test data which are loaded
 in the two files.

 The fixtures load correctly on the django database but will fail to load
 in the legacy database.
 The fixture loader notices that the administrative data fixture file has
 NO data and will rollback at this point.
 While this might be fine in a single database setup, it shouldn't rollback
 here since data were already loaded in the other database.

 {{{
 # If the fixture we loaded contains 0 objects, assume that an
 # error was encountered during fixture loading.
 if objects_in_fixture == 0:
     sys.stderr.write(
         self.style.ERROR("No fixture data found for '%s'. (File format may
 be invalid.)" %
             (fixture_name)))
     transaction.rollback(using=using)
     transaction.leave_transaction_management(using=using)
     return
 }}}

 According to me:
  - it would make sense to issue a warning, but one should probably add the
 database name in order to discard any confusing error message.
  - one should rollback if such error occur (the user has been notified
 about it)

 Maybe a better solution would be to let the test framework load a fixture
 in both database in a single call but that would require a major rework of
 the loaddata command and could possibly have side effects if one uses same
 class but different objects on different databases.

-- 
Ticket URL: <http://code.djangoproject.com/ticket/14068>
Django <http://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 post to this group, send email to django-upda...@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.

Reply via email to