fix: run all models when none specified, for import/export commands

This commit is contained in:
Lance Edgar 2025-12-20 17:28:06 -06:00
parent 7e3e892002
commit 4f80085254
3 changed files with 14 additions and 9 deletions

View file

@ -125,15 +125,15 @@ class ImportCommandHandler(GenericHandler):
return return
# otherwise process some data # otherwise process some data
log.debug("using handler: %s", self.import_handler.get_spec())
kw = dict(params) kw = dict(params)
models = kw.pop("models") models = kw.pop("models")
log.debug("using handler: %s", self.import_handler.get_spec()) if not models:
# TODO: need to use all/default models if none specified models = list(self.import_handler.importers)
# (and should know models by now for logging purposes)
log.debug( log.debug(
"running %s %s for: %s", "%s %s for models: %s",
self.import_handler, self.import_handler.actioning,
self.import_handler.orientation.value, self.import_handler.get_title(),
", ".join(models), ", ".join(models),
) )
log.debug("params are: %s", kw) log.debug("params are: %s", kw)

View file

@ -459,7 +459,10 @@ class Importer: # pylint: disable=too-many-instance-attributes,too-many-public-
updated = [] updated = []
deleted = [] deleted = []
log.debug("using key fields: %s", ", ".join(self.get_keys())) model_title = self.get_model_title()
log.debug(
"using key fields for %s: %s", model_title, ", ".join(self.get_keys())
)
# get complete set of normalized source data # get complete set of normalized source data
if source_data is None: if source_data is None:
@ -468,8 +471,7 @@ class Importer: # pylint: disable=too-many-instance-attributes,too-many-public-
# nb. prune duplicate records from source data # nb. prune duplicate records from source data
source_data, source_keys = self.get_unique_data(source_data) source_data, source_keys = self.get_unique_data(source_data)
model_title = self.get_model_title() log.debug("got %s %s records from source", len(source_data), model_title)
log.debug(f"got %s {model_title} records from source", len(source_data))
# maybe cache existing target data # maybe cache existing target data
if self.caches_target: if self.caches_target:

View file

@ -335,6 +335,9 @@ class ImportHandler(GenericHandler): # pylint: disable=too-many-public-methods
self.begin_transaction() self.begin_transaction()
changes = OrderedDict() changes = OrderedDict()
if not keys:
keys = list(self.importers)
success = False success = False
try: try: