Esempio n. 1
0
 def setUp(self):
     super().setUp()
     self.parser = AnalysisParser(
         results=ParseResult.rpc(),
         project=self.snowplow_project_config,
         root_project=self.root_project_config,
         macro_manifest=self.macro_manifest,
     )
Esempio n. 2
0
    def setUp(self):
        self.target_dict = {
            'type': 'oracle',
            'service': 'test',
            'username': '******',
            'host': 'thishostshouldnotexist',
            'password': '******',
            'port': 1521,
            'schema': 'public'
        }

        profile_cfg = {
            'outputs': {
                'test': self.target_dict,
            },
            'target': 'test'
        }
        project_cfg = {
            'name': 'X',
            'version': '0.1',
            'profile': 'test',
            'project-root': '/tmp/dbt/does-not-exist',
            'quoting': {
                'identifier': False,
                'schema': True,
            },
            'config-version': 2,
        }

        self.config = config_from_parts_or_dicts(project_cfg, profile_cfg)

        self.handle = mock.MagicMock(spec=cx_Oracle.Connection)
        self.cursor = self.handle.cursor.return_value
        self.mock_execute = self.cursor.execute
        self.patcher = mock.patch('dbt.adapters.oracle.connections.oracle')
        self.oracle = self.patcher.start()

        self.load_patch = mock.patch('dbt.parser.manifest.make_parse_result')
        self.mock_parse_result = self.load_patch.start()
        self.mock_parse_result.return_value = ParseResult.rpc()

        self.oracle.connect.return_value = self.handle
        self.adapter = OracleAdapter(self.config)
        self.adapter._macro_manifest_lazy = load_internal_manifest_macros(self.config)
        self.adapter.connections.query_header = MacroQueryStringSetter(self.config, self.adapter._macro_manifest_lazy)

        self.qh_patch = mock.patch.object(self.adapter.connections.query_header, 'add')
        self.mock_query_header_add = self.qh_patch.start()
        self.mock_query_header_add.side_effect = lambda q: '/* dbt */\n{}'.format(q)
        self.adapter.acquire_connection()
        inject_adapter(self.adapter, OraclePlugin)
Esempio n. 3
0
 def setUp(self):
     super().setUp()
     self.parser = MacroParser(
         results=ParseResult.rpc(),
         project=self.snowplow_project_config,
     )
Esempio n. 4
0
 def _new_results(self):
     return ParseResult(MatchingHash(), MatchingHash(), {})