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

Adding column schema attributes #1329

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

carolinabtt
Copy link

resolves # #1265
docs dbt-labs/docs.getdbt.com/#NA

Problem

Before this PR is merged, we could not identify if the target table have different description and default_value_expression than the model transformation. If the model use the Bigquery API copy_table, and we don't have description and default_value_expression defined in the schema.yml, the metadata will be deleted.

By extending this function _get_dbt_columns_from_bq_table to extract and store the description and default_value_expression from BigQuery's SchemaField objects, we could seamlessly compare the model transformation data with the table destination and decide if replace it or not with the information in the project yaml file.

Solution

One option to avoid deleting the metadata in the target table is using the feature persist_docs = true, but this means an extra step in the process, have to fill all the column descriptions in yml files, and is needed a table.update permission.

With this PR, we avoid this extra step and the metadata is updated with the transformation itself, with the API copy_table or MERGE statement, faster and cheaper.

@carolinabtt carolinabtt requested a review from a team as a code owner August 30, 2024 17:06
@cla-bot cla-bot bot added the cla:yes label Aug 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant