Skip to content

Commit

Permalink
feat(extractor): populate email to ownership in optimus and tableau (#…
Browse files Browse the repository at this point in the history
…286)

* feat(extractor): populate email to ownership in optimus and tableau

* fix(optimus): remove name from ownership field
  • Loading branch information
mabdh authored Dec 16, 2021
1 parent 6821986 commit 6610c15
Show file tree
Hide file tree
Showing 6 changed files with 94 additions and 83 deletions.
86 changes: 49 additions & 37 deletions models/odpf/assets/facets/ownership.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions plugins/extractors/optimus/optimus.go
Original file line number Diff line number Diff line change
Expand Up @@ -149,8 +149,8 @@ func (e *Extractor) buildJob(ctx context.Context, jobSpec *pb.JobSpecification,
Ownership: &facets.Ownership{
Owners: []*facets.Owner{
{
Urn: jobSpec.Owner,
Name: jobSpec.Owner,
Urn: jobSpec.Owner,
Email: jobSpec.Owner,
},
},
},
Expand Down
64 changes: 26 additions & 38 deletions plugins/extractors/optimus/testdata/expected.json
Original file line number Diff line number Diff line change
@@ -1,18 +1,15 @@
[
{
[{
"resource": {
"urn": "optimus::optimus:80/project-A.namespace-A.job-A",
"name": "job-A",
"service": "optimus",
"description": "sample description for job-A"
},
"ownership": {
"owners": [
{
"urn": "[email protected]",
"name": "[email protected]"
}
]
"owners": [{
"email": "[email protected]",
"urn": "[email protected]"
}]
},
"properties": {
"attributes": {
Expand All @@ -38,20 +35,16 @@
}
},
"lineage": {
"upstreams": [
{
"urn": "bigquery::src-project/src-dataset/src-table",
"type": "table",
"service": "bigquery"
}
],
"downstreams": [
{
"urn": "bigquery::dst-project/dst-dataset/dst-table",
"type": "table",
"service": "bigquery"
}
]
"upstreams": [{
"urn": "bigquery::src-project/src-dataset/src-table",
"type": "table",
"service": "bigquery"
}],
"downstreams": [{
"urn": "bigquery::dst-project/dst-dataset/dst-table",
"type": "table",
"service": "bigquery"
}]
}
},
{
Expand All @@ -62,12 +55,10 @@
"description": "sample description for job-B"
},
"ownership": {
"owners": [
{
"urn": "[email protected]",
"name": "[email protected]"
}
]
"owners": [{
"email": "[email protected]",
"urn": "[email protected]"
}]
},
"properties": {
"attributes": {
Expand All @@ -93,8 +84,7 @@
}
},
"lineage": {
"upstreams": [
{
"upstreams": [{
"urn": "bigquery::src-b1-project/src-b1-dataset/src-b1-table",
"type": "table",
"service": "bigquery"
Expand All @@ -105,13 +95,11 @@
"service": "bigquery"
}
],
"downstreams": [
{
"urn": "bigquery::dst-b-project/dst-b-dataset/dst-b-table",
"type": "table",
"service": "bigquery"
}
]
"downstreams": [{
"urn": "bigquery::dst-b-project/dst-b-dataset/dst-b-table",
"type": "table",
"service": "bigquery"
}]
}
}
]
]
9 changes: 9 additions & 0 deletions plugins/extractors/tableau/tableau.go
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,15 @@ func (e *Extractor) buildDashboard(wb *Workbook) (data *assets.Dashboard, err er
"owner_email": wb.Owner.Email,
}),
},
Ownership: &facets.Ownership{
Owners: []*facets.Owner{
{
Urn: wb.Owner.Email,
Name: wb.Owner.Name,
Email: wb.Owner.Email,
},
},
},
Lineage: lineages,
Timestamps: &common.Timestamp{
CreateTime: timestamppb.New(wb.CreatedAt),
Expand Down
7 changes: 4 additions & 3 deletions plugins/sinks/columbus/columbus.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ type LineageRecord struct {
}

type Owner struct {
URN string `json:"urn"`
Name string `json:"name"`
Role string `json:"role"`
URN string `json:"urn"`
Name string `json:"name"`
Role string `json:"role"`
Email string `json:"email"`
}
7 changes: 4 additions & 3 deletions plugins/sinks/columbus/sink.go
Original file line number Diff line number Diff line change
Expand Up @@ -189,9 +189,10 @@ func (s *Sink) buildOwners(metadata models.Metadata) (owners []Owner) {

for _, ownerProto := range ownership.GetOwners() {
owners = append(owners, Owner{
URN: ownerProto.Urn,
Name: ownerProto.Name,
Role: ownerProto.Role,
URN: ownerProto.Urn,
Name: ownerProto.Name,
Role: ownerProto.Role,
Email: ownerProto.Email,
})
}
return
Expand Down

0 comments on commit 6610c15

Please sign in to comment.