mirror of
https://github.com/datahub-project/datahub.git
synced 2025-11-01 19:25:56 +00:00
feat(ingest/glossary): handle ownership type in business glossary connector (#9805)
This commit is contained in:
parent
0d780e5f8f
commit
93a7afbf0f
@ -10,7 +10,12 @@ from pydantic.fields import Field
|
||||
import datahub.metadata.schema_classes as models
|
||||
from datahub.configuration.common import ConfigModel
|
||||
from datahub.configuration.config_loader import load_config_file
|
||||
from datahub.emitter.mce_builder import datahub_guid, make_group_urn, make_user_urn
|
||||
from datahub.emitter.mce_builder import (
|
||||
datahub_guid,
|
||||
make_group_urn,
|
||||
make_user_urn,
|
||||
validate_ownership_type,
|
||||
)
|
||||
from datahub.emitter.mcp import MetadataChangeProposalWrapper
|
||||
from datahub.ingestion.api.common import PipelineContext
|
||||
from datahub.ingestion.api.decorators import (
|
||||
@ -34,6 +39,7 @@ GlossaryNodeInterface = TypeVar(
|
||||
|
||||
|
||||
class Owners(ConfigModel):
|
||||
type: str = models.OwnershipTypeClass.DEVELOPER
|
||||
users: Optional[List[str]] = None
|
||||
groups: Optional[List[str]] = None
|
||||
|
||||
@ -147,12 +153,14 @@ def make_glossary_term_urn(
|
||||
|
||||
|
||||
def get_owners(owners: Owners) -> models.OwnershipClass:
|
||||
ownership_type, ownership_type_urn = validate_ownership_type(owners.type)
|
||||
owners_meta: List[models.OwnerClass] = []
|
||||
if owners.users is not None:
|
||||
owners_meta = owners_meta + [
|
||||
models.OwnerClass(
|
||||
owner=make_user_urn(o),
|
||||
type=models.OwnershipTypeClass.DEVELOPER,
|
||||
type=ownership_type,
|
||||
typeUrn=ownership_type_urn,
|
||||
)
|
||||
for o in owners.users
|
||||
]
|
||||
@ -160,7 +168,8 @@ def get_owners(owners: Owners) -> models.OwnershipClass:
|
||||
owners_meta = owners_meta + [
|
||||
models.OwnerClass(
|
||||
owner=make_group_urn(o),
|
||||
type=models.OwnershipTypeClass.DEVELOPER,
|
||||
type=ownership_type,
|
||||
typeUrn=ownership_type_urn,
|
||||
)
|
||||
for o in owners.groups
|
||||
]
|
||||
|
||||
@ -35,6 +35,7 @@ nodes:
|
||||
owners:
|
||||
users:
|
||||
- mjames
|
||||
type: DATAOWNER
|
||||
terms:
|
||||
- name: Email
|
||||
description: An individual's email address
|
||||
@ -54,6 +55,7 @@ nodes:
|
||||
owners:
|
||||
groups:
|
||||
- finance
|
||||
type: urn:li:ownershipType:my_cutom_type
|
||||
terms:
|
||||
- name: Account
|
||||
description: Container for records associated with a business arrangement for regular transactions and services
|
||||
|
||||
@ -246,7 +246,7 @@
|
||||
"owners": [
|
||||
{
|
||||
"owner": "urn:li:corpuser:mjames",
|
||||
"type": "DEVELOPER"
|
||||
"type": "DATAOWNER"
|
||||
}
|
||||
],
|
||||
"lastModified": {
|
||||
@ -331,7 +331,7 @@
|
||||
"owners": [
|
||||
{
|
||||
"owner": "urn:li:corpuser:mjames",
|
||||
"type": "DEVELOPER"
|
||||
"type": "DATAOWNER"
|
||||
}
|
||||
],
|
||||
"lastModified": {
|
||||
@ -377,7 +377,7 @@
|
||||
"owners": [
|
||||
{
|
||||
"owner": "urn:li:corpuser:mjames",
|
||||
"type": "DEVELOPER"
|
||||
"type": "DATAOWNER"
|
||||
}
|
||||
],
|
||||
"lastModified": {
|
||||
@ -412,7 +412,8 @@
|
||||
"owners": [
|
||||
{
|
||||
"owner": "urn:li:corpGroup:finance",
|
||||
"type": "DEVELOPER"
|
||||
"type": "CUSTOM",
|
||||
"typeUrn": "urn:li:ownershipType:my_cutom_type"
|
||||
}
|
||||
],
|
||||
"lastModified": {
|
||||
@ -461,7 +462,8 @@
|
||||
"owners": [
|
||||
{
|
||||
"owner": "urn:li:corpGroup:finance",
|
||||
"type": "DEVELOPER"
|
||||
"type": "CUSTOM",
|
||||
"typeUrn": "urn:li:ownershipType:my_cutom_type"
|
||||
}
|
||||
],
|
||||
"lastModified": {
|
||||
@ -500,7 +502,8 @@
|
||||
"owners": [
|
||||
{
|
||||
"owner": "urn:li:corpGroup:finance",
|
||||
"type": "DEVELOPER"
|
||||
"type": "CUSTOM",
|
||||
"typeUrn": "urn:li:ownershipType:my_cutom_type"
|
||||
}
|
||||
],
|
||||
"lastModified": {
|
||||
|
||||
@ -246,7 +246,7 @@
|
||||
"owners": [
|
||||
{
|
||||
"owner": "urn:li:corpuser:mjames",
|
||||
"type": "DEVELOPER"
|
||||
"type": "DATAOWNER"
|
||||
}
|
||||
],
|
||||
"lastModified": {
|
||||
@ -331,7 +331,7 @@
|
||||
"owners": [
|
||||
{
|
||||
"owner": "urn:li:corpuser:mjames",
|
||||
"type": "DEVELOPER"
|
||||
"type": "DATAOWNER"
|
||||
}
|
||||
],
|
||||
"lastModified": {
|
||||
@ -377,7 +377,7 @@
|
||||
"owners": [
|
||||
{
|
||||
"owner": "urn:li:corpuser:mjames",
|
||||
"type": "DEVELOPER"
|
||||
"type": "DATAOWNER"
|
||||
}
|
||||
],
|
||||
"lastModified": {
|
||||
@ -412,7 +412,8 @@
|
||||
"owners": [
|
||||
{
|
||||
"owner": "urn:li:corpGroup:finance",
|
||||
"type": "DEVELOPER"
|
||||
"type": "CUSTOM",
|
||||
"typeUrn": "urn:li:ownershipType:my_cutom_type"
|
||||
}
|
||||
],
|
||||
"lastModified": {
|
||||
@ -461,7 +462,8 @@
|
||||
"owners": [
|
||||
{
|
||||
"owner": "urn:li:corpGroup:finance",
|
||||
"type": "DEVELOPER"
|
||||
"type": "CUSTOM",
|
||||
"typeUrn": "urn:li:ownershipType:my_cutom_type"
|
||||
}
|
||||
],
|
||||
"lastModified": {
|
||||
@ -500,7 +502,8 @@
|
||||
"owners": [
|
||||
{
|
||||
"owner": "urn:li:corpGroup:finance",
|
||||
"type": "DEVELOPER"
|
||||
"type": "CUSTOM",
|
||||
"typeUrn": "urn:li:ownershipType:my_cutom_type"
|
||||
}
|
||||
],
|
||||
"lastModified": {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user