コード例 #1
0
ファイル: compilation.py プロジェクト: vishalbelsare/dbt
    def write_manifest_file(self, manifest):
        """Write the manifest file to disk.

        manifest should be a Manifest.
        """
        filename = manifest_file_name
        manifest_path = os.path.join(self.project['target-path'], filename)
        write_json(manifest_path, manifest.serialize())
コード例 #2
0
ファイル: generate.py プロジェクト: analyst-collective/dbt
    def run(self):
        compile_results = None
        if self.args.compile:
            compile_results = super(GenerateTask, self).run()
            if any(r.error is not None for r in compile_results):
                dbt.ui.printer.print_timestamped_line(
                    'compile failed, cannot generate docs'
                )
                return {'compile_results': compile_results}

        shutil.copyfile(
            DOCS_INDEX_FILE_PATH,
            os.path.join(self.config.target_path, 'index.html'))

        manifest = self._get_manifest()
        adapter = get_adapter(self.config)

        dbt.ui.printer.print_timestamped_line("Building catalog")
        results = adapter.get_catalog(manifest)

        results = [
            dict(zip(results.column_names, row))
            for row in results
        ]

        nested_results = unflatten(results)
        results = {
            'nodes': incorporate_catalog_unique_ids(nested_results, manifest),
            'generated_at': dbt.utils.timestring(),
        }

        path = os.path.join(self.config.target_path, CATALOG_FILENAME)
        write_json(path, results)

        dbt.ui.printer.print_timestamped_line(
            'Catalog written to {}'.format(os.path.abspath(path))
        )
        # now that we've serialized the data we can add compile_results in to
        # make interpret_results happy.
        results['compile_results'] = compile_results

        return results
コード例 #3
0
    def run(self):
        compile_results = None
        if self.args.compile:
            compile_results = super(GenerateTask, self).run()
            if any(r.errored for r in compile_results):
                dbt.ui.printer.print_timestamped_line(
                    'compile failed, cannot generate docs')
                return {'compile_results': compile_results}

        shutil.copyfile(
            DOCS_INDEX_FILE_PATH,
            os.path.join(self.project['target-path'], 'index.html'))

        manifest = self._get_manifest()
        profile = self.project.run_environment()
        adapter = get_adapter(profile)

        dbt.ui.printer.print_timestamped_line("Building catalog")
        results = adapter.get_catalog(profile, self.project.cfg, manifest)

        results = [dict(zip(results.column_names, row)) for row in results]

        nested_results = unflatten(results)
        results = {
            'nodes': incorporate_catalog_unique_ids(nested_results, manifest),
            'generated_at': dbt.utils.timestring(),
        }

        path = os.path.join(self.project['target-path'], CATALOG_FILENAME)
        write_json(path, results)

        dbt.ui.printer.print_timestamped_line('Catalog written to {}'.format(
            os.path.abspath(path)))
        # now that we've serialized the data we can add compile_results in to
        # make interpret_results happy.
        results['compile_results'] = compile_results

        return results
コード例 #4
0
ファイル: util.py プロジェクト: convoyinc/dbt
 def write(self, path: str, omit_none: bool = False):
     write_json(path, self.to_dict(omit_none=omit_none))  # type: ignore
コード例 #5
0
 def write_results(self, execution_result):
     filepath = os.path.join(self.project['target-path'], RESULT_FILE_NAME)
     write_json(filepath, execution_result.serialize())
コード例 #6
0
ファイル: runner.py プロジェクト: massmutual/dbt
 def write_results(self, execution_result):
     filepath = os.path.join(self.config.target_path, RESULT_FILE_NAME)
     write_json(filepath, execution_result.serialize())
コード例 #7
0
ファイル: object.py プロジェクト: insurancezebra/dbt-core
 def write(self, path):
     write_json(path, self.serialize())
コード例 #8
0
ファイル: results.py プロジェクト: chrisp-data/all_data
 def write(self, path: str):
     write_json(path, self.to_dict(omit_none=False))