diff --git a/src/wuttasync/cli/base.py b/src/wuttasync/cli/base.py index e972e18..56d6421 100644 --- a/src/wuttasync/cli/base.py +++ b/src/wuttasync/cli/base.py @@ -125,15 +125,15 @@ class ImportCommandHandler(GenericHandler): return # otherwise process some data + log.debug("using handler: %s", self.import_handler.get_spec()) kw = dict(params) models = kw.pop("models") - log.debug("using handler: %s", self.import_handler.get_spec()) - # TODO: need to use all/default models if none specified - # (and should know models by now for logging purposes) + if not models: + models = list(self.import_handler.importers) log.debug( - "running %s %s for: %s", - self.import_handler, - self.import_handler.orientation.value, + "%s %s for models: %s", + self.import_handler.actioning, + self.import_handler.get_title(), ", ".join(models), ) log.debug("params are: %s", kw) diff --git a/src/wuttasync/importing/base.py b/src/wuttasync/importing/base.py index ca0718e..b625b17 100644 --- a/src/wuttasync/importing/base.py +++ b/src/wuttasync/importing/base.py @@ -459,7 +459,10 @@ class Importer: # pylint: disable=too-many-instance-attributes,too-many-public- updated = [] 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 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 source_data, source_keys = self.get_unique_data(source_data) - model_title = self.get_model_title() - log.debug(f"got %s {model_title} records from source", len(source_data)) + log.debug("got %s %s records from source", len(source_data), model_title) # maybe cache existing target data if self.caches_target: diff --git a/src/wuttasync/importing/handlers.py b/src/wuttasync/importing/handlers.py index 2a0ba71..ac13f28 100644 --- a/src/wuttasync/importing/handlers.py +++ b/src/wuttasync/importing/handlers.py @@ -335,6 +335,9 @@ class ImportHandler(GenericHandler): # pylint: disable=too-many-public-methods self.begin_transaction() changes = OrderedDict() + if not keys: + keys = list(self.importers) + success = False try: