def fqn(self): """fully-qualified name for model. Includes all subdirs below 'models' path and the filename""" parts = split_path(self.filepath) name, _ = os.path.splitext(parts[-1]) test_name = DryCreateTemplate.model_name(name) return [self.own_project['name']] + parts[1:-1] + [test_name]
def get_fqn(self, path: str, name: str) -> List[str]: """Get the FQN for the node. This impacts node selection and config application. On snapshots, the fqn includes the filename. """ no_ext = os.path.splitext(path)[0] fqn = [self.project.project_name] fqn.extend(split_path(no_ext)) fqn.append(name) return fqn
def compile_model(self, linker, model, models): try: jinja = jinja2.Environment(loader=jinja2.FileSystemLoader( searchpath=model.root_dir)) # this is a dumb jinja2 bug -- on windows, forward slashes are EXPECTED posix_filepath = '/'.join(split_path(model.rel_filepath)) template = jinja.get_template(posix_filepath) context = self.get_context(linker, model, models) rendered = template.render(context) except jinja2.exceptions.TemplateSyntaxError as e: compiler_error(model, str(e)) return rendered
def fqn(self): parts = split_path(self.filepath) name, _ = os.path.splitext(parts[-1]) return [self.project['name']] + parts[1:-1] + \ ['schema', self.get_filename()]
def get_fqn_prefix(self, path: str) -> List[str]: no_ext = os.path.splitext(path)[0] fqn = [self.project.project_name] fqn.extend(utils.split_path(no_ext)[:-1]) return fqn
def original_fqn(self): parts = split_path(self.filepath) name, _ = os.path.splitext(parts[-1]) return [self.project['name']] + parts[1:-1] + [name]
def fqn(self): "fully-qualified name for model. Includes all subdirs below 'models' path and the filename" parts = split_path(self.filepath) name, _ = os.path.splitext(parts[-1]) return [self.own_project['name']] + parts[1:-1] + [name]