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 collections import OrderedDict from django.apps import apps from django.conf import settings from django.core import serializers from django.db import router from django.db.models import Q from corehq.apps.dump_reload.exceptions import DomainDumpError from corehq.apps.dump_reload.sql.filters import SimpleFilter, UsernameFilter, UserIDFilter from corehq.apps.dump_reload.sql.serialization import JsonLinesSerializer from corehq.sql_db.config import partition_config APP_LABELS_WITH_FILTER_KWARGS_TO_DUMP = { 'locations.LocationType': SimpleFilter('domain'), 'locations.SQLLocation': SimpleFilter('domain'), 'form_processor.XFormInstanceSQL': SimpleFilter('domain'), 'form_processor.XFormAttachmentSQL': SimpleFilter('form__domain'), 'form_processor.XFormOperationSQL': SimpleFilter('form__domain'), 'form_processor.CommCareCaseSQL': SimpleFilter('domain'), 'form_processor.CommCareCaseIndexSQL': SimpleFilter('domain'), 'form_processor.CaseAttachmentSQL': SimpleFilter('case__domain'), 'form_processor.CaseTransaction': SimpleFilter('case__domain'), 'form_processor.LedgerValue': SimpleFilter('domain'), 'form_processor.LedgerTransaction': SimpleFilter('case__domain'), 'case_search.CaseSearchConfig': SimpleFilter('domain'), 'data_interfaces.AutomaticUpdateRule': SimpleFilter('domain'), 'data_interfaces.AutomaticUpdateRuleCriteria': SimpleFilter('rule__domain'), 'data_interfaces.AutomaticUpdateAction': SimpleFilter('rule__domain'), 'auth.User': UsernameFilter(),
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 django.apps import apps from django.conf import settings from django.core import serializers 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 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 from corehq.util.decorators import ContextDecorator # order is important here for foreign key constraints APP_LABELS_WITH_FILTER_KWARGS_TO_DUMP = OrderedDict([ ('locations.LocationType', SimpleFilter('domain')), ('locations.SQLLocation', SimpleFilter('domain')), ('form_processor.XFormInstanceSQL', SimpleFilter('domain')), ('form_processor.XFormAttachmentSQL', SimpleFilter('form__domain')), ('form_processor.XFormOperationSQL', SimpleFilter('form__domain')), ('form_processor.CommCareCaseSQL', SimpleFilter('domain')), ('form_processor.CommCareCaseIndexSQL', SimpleFilter('domain')), ('form_processor.CaseAttachmentSQL', SimpleFilter('case__domain')), ('form_processor.CaseTransaction', SimpleFilter('case__domain')), ('form_processor.LedgerValue', SimpleFilter('domain')), ('form_processor.LedgerTransaction', SimpleFilter('case__domain')), ('case_search.CaseSearchConfig', SimpleFilter('domain')), ('data_interfaces.AutomaticUpdateRule', SimpleFilter('domain')), ('data_interfaces.AutomaticUpdateRuleCriteria', SimpleFilter('rule__domain')), ('data_interfaces.AutomaticUpdateAction', SimpleFilter('rule__domain')), ('auth.User', UsernameFilter()),
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',
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 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')), FilteredModelIteratorBuilder('form_processor.LedgerValue', SimpleFilter('domain')), FilteredModelIteratorBuilder('form_processor.LedgerTransaction', SimpleFilter('case__domain')), FilteredModelIteratorBuilder('case_search.CaseSearchConfig', SimpleFilter('domain')), UniqueFilteredModelIteratorBuilder('scheduling.SMSContent', SimpleFilter('alertevent__schedule__domain')), UniqueFilteredModelIteratorBuilder('scheduling.SMSContent', SimpleFilter('timedevent__schedule__domain')), UniqueFilteredModelIteratorBuilder('scheduling.SMSContent', SimpleFilter('randomtimedevent__schedule__domain')),