Exemple #1
0
    def test_dashboard_last_modified_extractor(self) -> None:

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

        })

        extractor = TableauDashboardLastModifiedExtractor()
        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._last_modified_timestamp, 1596572165)

        record = extractor.extract()
        self.assertIsNone(record)
Exemple #2
0
def run_tableau_last_modified_job():
    task = DefaultTask(extractor=TableauDashboardLastModifiedExtractor(),
                       loader=FsNeo4jCSVLoader())

    tmp_folder = '/var/tmp/amundsen/tableau_dashboard_user'

    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_last_modified.api_base_url':
        tableau_api_base_url,
        'extractor.tableau_dashboard_last_modified.api_version':
        tableau_api_version,
        'extractor.tableau_dashboard_last_modified.site_name':
        tableau_site_name,
        'extractor.tableau_dashboard_last_modified.tableau_personal_access_token_name':
        tableau_personal_access_token_name,
        'extractor.tableau_dashboard_last_modified.tableau_personal_access_token_secret':
        tableau_personal_access_token_secret,
        'extractor.tableau_dashboard_last_modified.excluded_projects':
        tableau_excluded_projects,
        'extractor.tableau_dashboard_last_modified.cluster':
        tableau_dashboard_cluster,
        'extractor.tableau_dashboard_last_modified.database':
        tableau_dashboard_database,
        'extractor.tableau_dashboard_last_modified.transformer.timestamp_str_to_epoch.timestamp_format':
        "%Y-%m-%dT%H:%M:%SZ",
        'extractor.tableau_dashboard_last_modified.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()