Beispiel #1
0
 def setUp(self):
     self.engine = create_fixtures()
     self.config = Config({})
     self.config._engine = self.engine
     self.config.setup()
     spec = load_config(os.path.join(FIXTURE_PATH, 'spec.yaml'))
     self.spec = Spec(self.config, spec)
     self.spec._engine = self.engine
     self.gen = Generator(self.spec)
Beispiel #2
0
Datei: cli.py Projekt: occrp/loom
def map(ctx, spec_file):
    """ Map data from the database into modeled objects. """
    try:
        config = ctx.obj['CONFIG']
        spec = load_config(spec_file)
        spec = Spec(config, spec, path=spec_file)

        mapper = Mapper(config, spec)
        mapper.map()
    except LoomException as le:
        raise click.ClickException(le.message)
Beispiel #3
0
Datei: cli.py Projekt: occrp/loom
def cli(ctx, debug, config_file):
    """ Map data from a SQL database into a statement-based graph. """
    ctx.obj = ctx.obj or {}
    ctx.obj['DEBUG'] = debug

    config = load_config(config_file)
    ctx.obj['CONFIG'] = Config(config, path=config_file)
    ctx.obj['CONFIG'].setup()

    fmt = '[%(levelname)-8s] %(name)-12s: %(message)s'
    level = logging.DEBUG if debug else logging.INFO
    logging.basicConfig(level=level, format=fmt)
    logging.getLogger('requests').setLevel(logging.WARNING)
    logging.getLogger('urllib3').setLevel(logging.WARNING)
    logging.getLogger('elasticsearch').setLevel(logging.WARNING)