コード例 #1
0
ファイル: test_graph.py プロジェクト: vishalbelsare/dbt
    def test__dependency_list(self):
        self.use_models({
            'model_1': 'select * from events',
            'model_2': 'select * from {{ ref("model_1") }}',
            'model_3': '''
                select * from {{ ref("model_1") }}
                union all
                select * from {{ ref("model_2") }}
            ''',
            'model_4': 'select * from {{ ref("model_3") }}'
        })

        compiler = self.get_compiler(self.get_project({}))
        graph, linker = compiler.compile()

        actual_dep_list = linker.as_dependency_list()

        expected_dep_list = [
            ['model.test_models_compile.model_1'],
            ['model.test_models_compile.model_2'],
            ['model.test_models_compile.model_3'],
            ['model.test_models_compile.model_4'],
        ]

        self.assertEqual(actual_dep_list, expected_dep_list)
コード例 #2
0
    def test__dependency_list(self):
        self.use_models({
            'model_1': 'select * from events',
            'model_2': 'select * from {{ ref("model_1") }}',
            'model_3': '''
                select * from {{ ref("model_1") }}
                union all
                select * from {{ ref("model_2") }}
            ''',
            'model_4': 'select * from {{ ref("model_3") }}'
        })

        compiler = self.get_compiler(self.get_project({}))
        compiler.compile()

        linker = dbt.linker.Linker()
        linker.graph = self.graph_result

        actual_dep_list = linker.as_dependency_list()

        expected_dep_list = [[('test_models_compile', 'model_1')],
                             [('test_models_compile', 'model_2')],
                             [('test_models_compile', 'model_3')],
                             [
                                 ('test_models_compile', 'model_4'),
                             ]]

        self.assertEqual(actual_dep_list, expected_dep_list)
コード例 #3
0
ファイル: runner.py プロジェクト: bellhops/dbt
    def as_concurrent_dep_list(self, linker, nodes_to_run):
        dependency_list = linker.as_dependency_list(nodes_to_run)

        concurrent_dependency_list = []
        for level in dependency_list:
            node_level = [linker.get_node(node) for node in level]
            concurrent_dependency_list.append(node_level)

        return concurrent_dependency_list