Пример #1
0
def parse_archives_from_project(project):
    archives = []
    archive_configs = project.get('archive', [])

    for archive_config in archive_configs:
        tables = archive_config.get('tables')

        if tables is None:
            continue

        for table in tables:
            config = table.copy()
            config['source_schema'] = archive_config.get('source_schema')
            config['target_schema'] = archive_config.get('target_schema')

            archives.append({
                'name': table.get('target_table'),
                'root_path': project.get('project-root'),
                'resource_type': NodeType.Archive,
                'path': project.get('project-root'),
                'package_name': project.get('name'),
                'config': config,
                'raw_sql': '-- noop'
            })

    return archives
Пример #2
0
def parse_archives_from_project(project):
    archives = []
    archive_configs = project.get('archive', [])

    for archive_config in archive_configs:
        tables = archive_config.get('tables')

        if tables is None:
            continue

        for table in tables:
            config = table.copy()
            config['source_schema'] = archive_config.get('source_schema')
            config['target_schema'] = archive_config.get('target_schema')

            fake_path = [config['target_schema'], config['target_table']]
            archives.append({
                'name':
                table.get('target_table'),
                'root_path':
                project.get('project-root'),
                'resource_type':
                NodeType.Archive,
                'path':
                os.path.join('archive', *fake_path),
                'original_file_path':
                'dbt_project.yml',
                'package_name':
                project.get('name'),
                'config':
                config,
                'raw_sql':
                '{{config(materialized="archive")}} -- noop'
            })

    return archives