Ejemplo n.º 1
0
 def show(self, *args, **kwargs) -> None:
     if self.name not in active_deprecations:
         desc = self.description.format(**kwargs)
         msg = ui.line_wrap_message(desc, prefix='* Deprecation Warning: ')
         dbt.exceptions.warn_or_error(msg)
         self.track_deprecation_warn()
         active_deprecations.add(self.name)
Ejemplo n.º 2
0
def raise_invalid_patch(
    node,
    patch_section: str,
    patch_path: str,
) -> NoReturn:
    msg = line_wrap_message(f'''\
        '{node.name}' is a {node.resource_type} node, but it is
        specified in the {patch_section} section of
        {patch_path}.



        To fix this error, place the `{node.name}`
        specification under the {node.resource_type.pluralize()} key instead.
        ''')
    raise_compiler_error(msg, node)
Ejemplo n.º 3
0
    def add_macro(self, source_file: SourceFile, macro: ParsedMacro):
        if macro.unique_id in self.macros:
            # detect that the macro exists and emit an error
            other_path = self.macros[macro.unique_id].original_file_path
            # subtract 2 for the "Compilation Error" indent
            # note that the line wrap eats newlines, so if you want newlines,
            # this is the result :(
            msg = line_wrap_message(f'''\
                dbt found two macros named "{macro.name}" in the project
                "{macro.package_name}".


                To fix this error, rename or remove one of the following
                macros:

                    - {macro.original_file_path}

                    - {other_path}
                ''',
                                    subtract=2)
            raise_compiler_error(msg)

        self.macros[macro.unique_id] = macro
        self.get_file(source_file).macros.append(macro.unique_id)