Exemple #1
0
def run_tableau_table_job():
    task = DefaultTask(extractor=TableauDashboardTableExtractor(),
                       loader=FsNeo4jCSVLoader())

    tmp_folder = '/var/tmp/amundsen/tableau_dashboard_table'

    node_files_folder = '{tmp_folder}/nodes'.format(tmp_folder=tmp_folder)
    relationship_files_folder = '{tmp_folder}/relationships'.format(
        tmp_folder=tmp_folder)

    dict_config = common_tableau_config
    dict_config.update({
        'extractor.tableau_dashboard_table.api_base_url':
        tableau_api_base_url,
        'extractor.tableau_dashboard_table.api_version':
        tableau_api_version,
        'extractor.tableau_dashboard_table.site_name':
        tableau_site_name,
        'extractor.tableau_dashboard_table.tableau_personal_access_token_name':
        tableau_personal_access_token_name,
        'extractor.tableau_dashboard_table.tableau_personal_access_token_secret':
        tableau_personal_access_token_secret,
        'extractor.tableau_dashboard_table.excluded_projects':
        tableau_excluded_projects,
        'extractor.tableau_dashboard_table.cluster':
        tableau_dashboard_cluster,
        'extractor.tableau_dashboard_table.database':
        tableau_dashboard_database,
        'extractor.tableau_dashboard_table.external_cluster_name':
        tableau_external_table_cluster,
        'extractor.tableau_dashboard_table.external_schema_name':
        tableau_external_table_schema,
        'extractor.tableau_dashboard_table.transformer.timestamp_str_to_epoch.timestamp_format':
        "%Y-%m-%dT%H:%M:%SZ",
        'extractor.tableau_dashboard_table.verify_request':
        tableau_verify_request,
        'loader.filesystem_csv_neo4j.node_dir_path':
        node_files_folder,
        'loader.filesystem_csv_neo4j.relationship_dir_path':
        relationship_files_folder,
        'loader.filesystem_csv_neo4j.delete_created_directories':
        True,
        'task.progress_report_frequency':
        100,
        'publisher.neo4j.node_files_directory':
        node_files_folder,
        'publisher.neo4j.relation_files_directory':
        relationship_files_folder,
    })
    job_config = ConfigFactory.from_dict(dict_config)

    job = DefaultJob(conf=job_config, task=task, publisher=Neo4jCsvPublisher())

    job.launch()
Exemple #2
0
    def test_dashboard_table_extractor(self) -> None:

        config = ConfigFactory.from_dict({
            'extractor.tableau_dashboard_table.tableau_host':
            'tableau_host',
            'extractor.tableau_dashboard_table.api_version':
            'tableau_api_version',
            'extractor.tableau_dashboard_table.site_name':
            'tableau_site_name',
            'extractor.tableau_dashboard_table.tableau_personal_access_token_name':
            'tableau_personal_access_token_name',
            'extractor.tableau_dashboard_table.tableau_personal_access_token_secret':
            'tableau_personal_access_token_secret',
            'extractor.tableau_dashboard_table.excluded_projects': [],
            'extractor.tableau_dashboard_table.cluster':
            'tableau_dashboard_cluster',
            'extractor.tableau_dashboard_table.database':
            'tableau_dashboard_database',
            'extractor.tableau_dashboard_table.transformer.timestamp_str_to_epoch.timestamp_format':
            '%Y-%m-%dT%H:%M:%SZ',
        })

        extractor = TableauDashboardTableExtractor()
        extractor.init(
            Scoped.get_scoped_conf(conf=config, scope=extractor.get_scope()))
        record = extractor.extract()

        self.assertEqual(record._dashboard_id, 'Test Workbook')
        self.assertEqual(record._dashboard_group_id, 'Test Project')
        self.assertEqual(record._product, 'tableau')
        self.assertEqual(record._cluster, 'tableau_dashboard_cluster')
        self.assertEqual(record._table_ids, [
            'tableau_dashboard_database://tableau_dashboard_cluster.test_schema_1/test_table_1',
            'tableau_dashboard_database://tableau_dashboard_cluster.test_schema_2/test_table_2'
        ])