mirror of
https://github.com/datahub-project/datahub.git
synced 2025-11-17 20:03:59 +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
|
import datahub.metadata.schema_classes as models
|
||||||
from datahub.configuration.common import ConfigModel
|
from datahub.configuration.common import ConfigModel
|
||||||
from datahub.configuration.config_loader import load_config_file
|
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.emitter.mcp import MetadataChangeProposalWrapper
|
||||||
from datahub.ingestion.api.common import PipelineContext
|
from datahub.ingestion.api.common import PipelineContext
|
||||||
from datahub.ingestion.api.decorators import (
|
from datahub.ingestion.api.decorators import (
|
||||||
@ -34,6 +39,7 @@ GlossaryNodeInterface = TypeVar(
|
|||||||
|
|
||||||
|
|
||||||
class Owners(ConfigModel):
|
class Owners(ConfigModel):
|
||||||
|
type: str = models.OwnershipTypeClass.DEVELOPER
|
||||||
users: Optional[List[str]] = None
|
users: Optional[List[str]] = None
|
||||||
groups: 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:
|
def get_owners(owners: Owners) -> models.OwnershipClass:
|
||||||
|
ownership_type, ownership_type_urn = validate_ownership_type(owners.type)
|
||||||
owners_meta: List[models.OwnerClass] = []
|
owners_meta: List[models.OwnerClass] = []
|
||||||
if owners.users is not None:
|
if owners.users is not None:
|
||||||
owners_meta = owners_meta + [
|
owners_meta = owners_meta + [
|
||||||
models.OwnerClass(
|
models.OwnerClass(
|
||||||
owner=make_user_urn(o),
|
owner=make_user_urn(o),
|
||||||
type=models.OwnershipTypeClass.DEVELOPER,
|
type=ownership_type,
|
||||||
|
typeUrn=ownership_type_urn,
|
||||||
)
|
)
|
||||||
for o in owners.users
|
for o in owners.users
|
||||||
]
|
]
|
||||||
@ -160,7 +168,8 @@ def get_owners(owners: Owners) -> models.OwnershipClass:
|
|||||||
owners_meta = owners_meta + [
|
owners_meta = owners_meta + [
|
||||||
models.OwnerClass(
|
models.OwnerClass(
|
||||||
owner=make_group_urn(o),
|
owner=make_group_urn(o),
|
||||||
type=models.OwnershipTypeClass.DEVELOPER,
|
type=ownership_type,
|
||||||
|
typeUrn=ownership_type_urn,
|
||||||
)
|
)
|
||||||
for o in owners.groups
|
for o in owners.groups
|
||||||
]
|
]
|
||||||
|
|||||||
@ -35,6 +35,7 @@ nodes:
|
|||||||
owners:
|
owners:
|
||||||
users:
|
users:
|
||||||
- mjames
|
- mjames
|
||||||
|
type: DATAOWNER
|
||||||
terms:
|
terms:
|
||||||
- name: Email
|
- name: Email
|
||||||
description: An individual's email address
|
description: An individual's email address
|
||||||
@ -54,6 +55,7 @@ nodes:
|
|||||||
owners:
|
owners:
|
||||||
groups:
|
groups:
|
||||||
- finance
|
- finance
|
||||||
|
type: urn:li:ownershipType:my_cutom_type
|
||||||
terms:
|
terms:
|
||||||
- name: Account
|
- name: Account
|
||||||
description: Container for records associated with a business arrangement for regular transactions and services
|
description: Container for records associated with a business arrangement for regular transactions and services
|
||||||
|
|||||||
@ -246,7 +246,7 @@
|
|||||||
"owners": [
|
"owners": [
|
||||||
{
|
{
|
||||||
"owner": "urn:li:corpuser:mjames",
|
"owner": "urn:li:corpuser:mjames",
|
||||||
"type": "DEVELOPER"
|
"type": "DATAOWNER"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"lastModified": {
|
"lastModified": {
|
||||||
@ -331,7 +331,7 @@
|
|||||||
"owners": [
|
"owners": [
|
||||||
{
|
{
|
||||||
"owner": "urn:li:corpuser:mjames",
|
"owner": "urn:li:corpuser:mjames",
|
||||||
"type": "DEVELOPER"
|
"type": "DATAOWNER"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"lastModified": {
|
"lastModified": {
|
||||||
@ -377,7 +377,7 @@
|
|||||||
"owners": [
|
"owners": [
|
||||||
{
|
{
|
||||||
"owner": "urn:li:corpuser:mjames",
|
"owner": "urn:li:corpuser:mjames",
|
||||||
"type": "DEVELOPER"
|
"type": "DATAOWNER"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"lastModified": {
|
"lastModified": {
|
||||||
@ -412,7 +412,8 @@
|
|||||||
"owners": [
|
"owners": [
|
||||||
{
|
{
|
||||||
"owner": "urn:li:corpGroup:finance",
|
"owner": "urn:li:corpGroup:finance",
|
||||||
"type": "DEVELOPER"
|
"type": "CUSTOM",
|
||||||
|
"typeUrn": "urn:li:ownershipType:my_cutom_type"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"lastModified": {
|
"lastModified": {
|
||||||
@ -461,7 +462,8 @@
|
|||||||
"owners": [
|
"owners": [
|
||||||
{
|
{
|
||||||
"owner": "urn:li:corpGroup:finance",
|
"owner": "urn:li:corpGroup:finance",
|
||||||
"type": "DEVELOPER"
|
"type": "CUSTOM",
|
||||||
|
"typeUrn": "urn:li:ownershipType:my_cutom_type"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"lastModified": {
|
"lastModified": {
|
||||||
@ -500,7 +502,8 @@
|
|||||||
"owners": [
|
"owners": [
|
||||||
{
|
{
|
||||||
"owner": "urn:li:corpGroup:finance",
|
"owner": "urn:li:corpGroup:finance",
|
||||||
"type": "DEVELOPER"
|
"type": "CUSTOM",
|
||||||
|
"typeUrn": "urn:li:ownershipType:my_cutom_type"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"lastModified": {
|
"lastModified": {
|
||||||
|
|||||||
@ -246,7 +246,7 @@
|
|||||||
"owners": [
|
"owners": [
|
||||||
{
|
{
|
||||||
"owner": "urn:li:corpuser:mjames",
|
"owner": "urn:li:corpuser:mjames",
|
||||||
"type": "DEVELOPER"
|
"type": "DATAOWNER"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"lastModified": {
|
"lastModified": {
|
||||||
@ -331,7 +331,7 @@
|
|||||||
"owners": [
|
"owners": [
|
||||||
{
|
{
|
||||||
"owner": "urn:li:corpuser:mjames",
|
"owner": "urn:li:corpuser:mjames",
|
||||||
"type": "DEVELOPER"
|
"type": "DATAOWNER"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"lastModified": {
|
"lastModified": {
|
||||||
@ -377,7 +377,7 @@
|
|||||||
"owners": [
|
"owners": [
|
||||||
{
|
{
|
||||||
"owner": "urn:li:corpuser:mjames",
|
"owner": "urn:li:corpuser:mjames",
|
||||||
"type": "DEVELOPER"
|
"type": "DATAOWNER"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"lastModified": {
|
"lastModified": {
|
||||||
@ -412,7 +412,8 @@
|
|||||||
"owners": [
|
"owners": [
|
||||||
{
|
{
|
||||||
"owner": "urn:li:corpGroup:finance",
|
"owner": "urn:li:corpGroup:finance",
|
||||||
"type": "DEVELOPER"
|
"type": "CUSTOM",
|
||||||
|
"typeUrn": "urn:li:ownershipType:my_cutom_type"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"lastModified": {
|
"lastModified": {
|
||||||
@ -461,7 +462,8 @@
|
|||||||
"owners": [
|
"owners": [
|
||||||
{
|
{
|
||||||
"owner": "urn:li:corpGroup:finance",
|
"owner": "urn:li:corpGroup:finance",
|
||||||
"type": "DEVELOPER"
|
"type": "CUSTOM",
|
||||||
|
"typeUrn": "urn:li:ownershipType:my_cutom_type"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"lastModified": {
|
"lastModified": {
|
||||||
@ -500,7 +502,8 @@
|
|||||||
"owners": [
|
"owners": [
|
||||||
{
|
{
|
||||||
"owner": "urn:li:corpGroup:finance",
|
"owner": "urn:li:corpGroup:finance",
|
||||||
"type": "DEVELOPER"
|
"type": "CUSTOM",
|
||||||
|
"typeUrn": "urn:li:ownershipType:my_cutom_type"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"lastModified": {
|
"lastModified": {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user