from django.db import router from corehq.apps.dump_reload.exceptions import DomainDumpError from corehq.apps.dump_reload.interface import DataDumper from corehq.apps.dump_reload.sql.filters import ( SimpleFilter, UsernameFilter, UserIDFilter, FilteredModelIteratorBuilder, UniqueFilteredModelIteratorBuilder) from corehq.apps.dump_reload.sql.serialization import JsonLinesSerializer from corehq.apps.dump_reload.util import get_model_label from corehq.sql_db.config import partition_config # order is important here for foreign key constraints APP_LABELS_WITH_FILTER_KWARGS_TO_DUMP = OrderedDict(( iterator.model_label, iterator ) for iterator in [ FilteredModelIteratorBuilder('locations.LocationType', SimpleFilter('domain')), FilteredModelIteratorBuilder('locations.SQLLocation', SimpleFilter( 'domain')), FilteredModelIteratorBuilder('blobs.BlobMeta', SimpleFilter('domain')), FilteredModelIteratorBuilder('form_processor.XFormInstanceSQL', SimpleFilter('domain')), FilteredModelIteratorBuilder('form_processor.XFormOperationSQL', SimpleFilter('form__domain')), FilteredModelIteratorBuilder('form_processor.CommCareCaseSQL', SimpleFilter('domain')), FilteredModelIteratorBuilder('form_processor.CommCareCaseIndexSQL', SimpleFilter('domain')), FilteredModelIteratorBuilder('form_processor.CaseAttachmentSQL', SimpleFilter('case__domain')), FilteredModelIteratorBuilder('form_processor.CaseTransaction', SimpleFilter('case__domain')),
from corehq.apps.dump_reload.exceptions import DomainDumpError from corehq.apps.dump_reload.interface import DataDumper from corehq.apps.dump_reload.sql.filters import ( FilteredModelIteratorBuilder, SimpleFilter, UniqueFilteredModelIteratorBuilder, UserIDFilter, UsernameFilter) from corehq.apps.dump_reload.sql.serialization import JsonLinesSerializer from corehq.apps.dump_reload.util import get_model_label, get_model_class from corehq.sql_db.config import plproxy_config # order is important here for foreign key constraints APP_LABELS_WITH_FILTER_KWARGS_TO_DUMP = defaultdict(list) [ APP_LABELS_WITH_FILTER_KWARGS_TO_DUMP[iterator.model_label].append( iterator) for iterator in [ FilteredModelIteratorBuilder('locations.LocationType', SimpleFilter('domain')), FilteredModelIteratorBuilder('locations.SQLLocation', SimpleFilter('domain')), FilteredModelIteratorBuilder('blobs.BlobMeta', SimpleFilter('domain')), FilteredModelIteratorBuilder('form_processor.XFormInstanceSQL', SimpleFilter('domain')), FilteredModelIteratorBuilder('form_processor.XFormOperationSQL', SimpleFilter('form__domain')), FilteredModelIteratorBuilder('form_processor.CommCareCaseSQL', SimpleFilter('domain')), FilteredModelIteratorBuilder('form_processor.CommCareCaseIndexSQL', SimpleFilter('domain')), FilteredModelIteratorBuilder('form_processor.CaseAttachmentSQL', SimpleFilter('case__domain')), FilteredModelIteratorBuilder('form_processor.CaseTransaction', SimpleFilter('case__domain')),
from corehq.apps.dump_reload.interface import DataDumper from corehq.apps.dump_reload.sql.filters import ( FilteredModelIteratorBuilder, ManyFilters, SimpleFilter, UniqueFilteredModelIteratorBuilder, UserIDFilter, UsernameFilter, ) from corehq.apps.dump_reload.sql.serialization import JsonLinesSerializer from corehq.apps.dump_reload.util import get_model_class, get_model_label from corehq.sql_db.config import plproxy_config APP_LABELS_WITH_FILTER_KWARGS_TO_DUMP = defaultdict(list) [APP_LABELS_WITH_FILTER_KWARGS_TO_DUMP[iterator.model_label].append(iterator) for iterator in [ FilteredModelIteratorBuilder('locations.LocationType', SimpleFilter('domain')), FilteredModelIteratorBuilder('locations.SQLLocation', SimpleFilter('domain')), FilteredModelIteratorBuilder('blobs.BlobMeta', SimpleFilter('domain')), FilteredModelIteratorBuilder('form_processor.XFormInstanceSQL', SimpleFilter('domain')), FilteredModelIteratorBuilder('form_processor.XFormOperationSQL', SimpleFilter('form__domain')), FilteredModelIteratorBuilder('form_processor.CommCareCaseSQL', SimpleFilter('domain')), FilteredModelIteratorBuilder('form_processor.CommCareCaseIndexSQL', SimpleFilter('domain')), FilteredModelIteratorBuilder('form_processor.CaseAttachmentSQL', SimpleFilter('case__domain')), FilteredModelIteratorBuilder('form_processor.CaseTransaction', SimpleFilter('case__domain')), FilteredModelIteratorBuilder('form_processor.LedgerValue', SimpleFilter('domain')), FilteredModelIteratorBuilder('form_processor.LedgerTransaction', SimpleFilter('case__domain')), FilteredModelIteratorBuilder('case_search.CaseSearchConfig', SimpleFilter('domain')), FilteredModelIteratorBuilder('case_search.FuzzyProperties', SimpleFilter('domain')), UniqueFilteredModelIteratorBuilder('scheduling.SMSContent', SimpleFilter('alertevent__schedule__domain')), UniqueFilteredModelIteratorBuilder('scheduling.SMSContent', SimpleFilter('timedevent__schedule__domain')), UniqueFilteredModelIteratorBuilder('scheduling.SMSContent',