Example #1
0
 def handle(self, *args, **options):
     domain_names = args or [d["key"] for d in Domain.get_all(include_docs=False)]
     for d in domain_names:
         print "Migrating cases in project space: %s" % d
         key = ["all", d]
         results = get_db().view('case/all_cases',
             startkey=key,
             endkey=key + [{}],
             reduce=False,
             include_docs=False,
         )
         for case_ids in chunked([r['id'] for r in results], 100):
             for case in wrapped_docs(CommCareCase, case_ids):
                 if add_to_case(case):
                     case.save()
Example #2
0
 def __iter__(self):
     for case_ids in chunked(self.all_case_ids, 500):
         for case in wrapped_docs(CommCareCase, case_ids):
             yield case
Example #3
0
 def __iter__(self):
     for case_ids in chunked(self.all_case_ids, 500):
         for case in wrapped_docs(CommCareCase, case_ids):
             yield case
Example #4
0
 def stream_cases(all_case_ids):
     for case_ids in chunked(all_case_ids, 1000):
         for case in wrapped_docs(CommCareCase, keys=case_ids):
         # for case in CommCareCase.view('_all_docs', keys=case_ids, include_docs=True):
             yield case
 def stream_cases(all_case_ids):
     for case_ids in chunked(all_case_ids, 1000):
         for case in wrapped_docs(CommCareCase, keys=case_ids):
             # for case in CommCareCase.view('_all_docs', keys=case_ids, include_docs=True):
             yield case