Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

catalog generation for bigquery #830

Closed
cmcarthur opened this issue Jul 9, 2018 · 2 comments
Closed

catalog generation for bigquery #830

cmcarthur opened this issue Jul 9, 2018 · 2 comments
Assignees

Comments

@cmcarthur
Copy link
Member

@drewbanin has something partially working for this

@drewbanin
Copy link
Contributor

This is a one-off function from a little bit of experimentation I did recently.

# adapters/bigquery/impl.py

    @classmethod
    def get_catalog(cls, profile, project_cfg, manifest):
        # schemas = cls.get_existing_schemas(profile, project_cfg)
        schemas = list({node.to_dict()['schema'] for node in manifest.nodes.values()})

        columns = []

        for j, schema_name in enumerate(schemas):
            relations = cls.list_relations(profile, project_cfg, schema_name)
            for i, relation in enumerate(relations):
                cols = cls.get_columns_in_table(profile, project_cfg, schema_name, relation.name)
                for col_index, col in enumerate(cols):
                    columns.append({
                        "table_schema": relation.schema,
                        "table_name": relation.name,
                        "table_type": relation.type,
                        "table_comment": None,
                        "column_name": col.name,
                        "column_index": col_index,
                        "column_type": col.data_type,
                        "column_comment": None
                    })


        return dbt.clients.agate_helper.table_from_data(columns)

@drewbanin
Copy link
Contributor

Added in #857, closing

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants