Coverage for pystratum_cli/command/RoutineLoaderCommand.py: 100%
12 statements
« prev ^ index » next coverage.py v7.2.7, created at 2024-05-12 12:02 +0200
« prev ^ index » next coverage.py v7.2.7, created at 2024-05-12 12:02 +0200
1from pystratum_cli.command.BaseCommand import BaseCommand
4class RoutineLoaderCommand(BaseCommand):
5 """
6 Command for loading stored routines into a database instance from pseudo SQL files.
8 loader
9 {config_file : The stratum configuration file}
10 {file_names?* : Sources with stored routines}
11 """
13 # ------------------------------------------------------------------------------------------------------------------
14 def handle(self) -> int:
15 """
16 Executes constants command when StratumCommand is activated.
17 """
18 self._read_config_file(self.input)
20 factory = self._create_backend_factory()
21 worker = factory.create_routine_loader_worker(self._config, self._io)
22 file_names = self.input.get_argument('file_names')
24 if not worker:
25 self._io.title('Loader')
26 self._io.error('Loader command is not implemented by the backend')
27 return -1
29 return worker.execute(file_names)
31# ----------------------------------------------------------------------------------------------------------------------