Skip to content

Commit

Permalink
feat(bigquery): add taxonomy name along with policy tag name for colu…
Browse files Browse the repository at this point in the history
…mns in bigquery asset
  • Loading branch information
ravisuhag committed May 29, 2024
1 parent 0ff71e6 commit e9f4bef
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion plugins/extractors/bigquery/bigquery.go
Original file line number Diff line number Diff line change
Expand Up @@ -704,7 +704,20 @@ func (e *Extractor) getPolicyTagList(ctx context.Context, col *bigquery.FieldSch
continue
}

pt = append(pt, fmt.Sprintf("policy_tag:%s:%s", policyTag.DisplayName, policyTag.Name))
policyTagSplit := strings.Split(name, "/")
if len(policyTagSplit) < 2 {
e.logger.Error("error splitting policy tag ", "policy_tag", name, "err", "incorrect format")
continue
}

taxonomyResourceName := strings.Join(policyTagSplit[:len(policyTagSplit)-2], "/")
taxonomy, err := e.policyTagClient.GetTaxonomy(ctx, &datacatalogpb.GetTaxonomyRequest{Name: taxonomyResourceName})
if err != nil {
e.logger.Error("error fetching taxonomy", "taxonomy", taxonomy, "err", err)
continue
}

pt = append(pt, fmt.Sprintf("%s:%s:%s", taxonomy.DisplayName, policyTag.DisplayName, policyTag.Name))
}

return pt
Expand Down

0 comments on commit e9f4bef

Please sign in to comment.