mirror of
https://github.com/open-metadata/OpenMetadata.git
synced 2025-08-15 12:37:18 +00:00
Glossary Entity Added - Ingestion fix (#2794)
* Added Glossary * Modified Glossary: Mixin and suffix * Glossary Mixin Methods * Sample Data and Mixin for Glossary * Modified comments * Glossary Mixin Updated * Added Glossary import * Import issues fixed, removed upper limit for jinja2 as it conflicted * Removed Glossary Import
This commit is contained in:
parent
f304d290b4
commit
959d441661
@ -42,7 +42,7 @@ base_requirements = {
|
|||||||
"sql-metadata~=2.0.0",
|
"sql-metadata~=2.0.0",
|
||||||
"requests~=2.26",
|
"requests~=2.26",
|
||||||
"cryptography",
|
"cryptography",
|
||||||
"Jinja2>=2.11.3, <3.0",
|
"Jinja2>=2.11.3",
|
||||||
"PyYAML",
|
"PyYAML",
|
||||||
"jsonschema",
|
"jsonschema",
|
||||||
"parsimonious==0.8.1",
|
"parsimonious==0.8.1",
|
||||||
|
@ -0,0 +1,24 @@
|
|||||||
|
"""
|
||||||
|
Mixin class containing Glossaries specific methods
|
||||||
|
|
||||||
|
To be used be OpenMetadata
|
||||||
|
"""
|
||||||
|
import logging
|
||||||
|
from typing import Type, TypeVar
|
||||||
|
|
||||||
|
from pydantic import BaseModel
|
||||||
|
|
||||||
|
T = TypeVar("T", bound=BaseModel) # pylint: disable=invalid-name
|
||||||
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
|
class GlossaryMixin:
|
||||||
|
def create_glossaries_category(self, entity: Type[T], glossaries_body):
|
||||||
|
"""Method to create new Glossary category
|
||||||
|
Args:
|
||||||
|
glossaries_body (Glossary): body of the request
|
||||||
|
"""
|
||||||
|
resp = self.client.put(
|
||||||
|
path=self.get_suffix(entity), data=glossaries_body.json()
|
||||||
|
)
|
||||||
|
logger.info(f"Created a Glossary: {resp}")
|
@ -25,6 +25,7 @@ from metadata.generated.schema.api.lineage.addLineage import AddLineageRequest
|
|||||||
from metadata.generated.schema.entity.data.chart import Chart
|
from metadata.generated.schema.entity.data.chart import Chart
|
||||||
from metadata.generated.schema.entity.data.dashboard import Dashboard
|
from metadata.generated.schema.entity.data.dashboard import Dashboard
|
||||||
from metadata.generated.schema.entity.data.database import Database
|
from metadata.generated.schema.entity.data.database import Database
|
||||||
|
from metadata.generated.schema.entity.data.glossary import Glossary
|
||||||
from metadata.generated.schema.entity.data.location import Location
|
from metadata.generated.schema.entity.data.location import Location
|
||||||
from metadata.generated.schema.entity.data.metrics import Metrics
|
from metadata.generated.schema.entity.data.metrics import Metrics
|
||||||
from metadata.generated.schema.entity.data.mlmodel import MlModel
|
from metadata.generated.schema.entity.data.mlmodel import MlModel
|
||||||
@ -47,6 +48,7 @@ from metadata.generated.schema.type.entityHistory import EntityVersionHistory
|
|||||||
from metadata.generated.schema.type.entityReference import EntityReference
|
from metadata.generated.schema.type.entityReference import EntityReference
|
||||||
from metadata.ingestion.ometa.auth_provider import AuthenticationProvider
|
from metadata.ingestion.ometa.auth_provider import AuthenticationProvider
|
||||||
from metadata.ingestion.ometa.client import REST, APIError, ClientConfig
|
from metadata.ingestion.ometa.client import REST, APIError, ClientConfig
|
||||||
|
from metadata.ingestion.ometa.mixins.glossary_mixin import GlossaryMixin
|
||||||
from metadata.ingestion.ometa.mixins.mlmodel_mixin import OMetaMlModelMixin
|
from metadata.ingestion.ometa.mixins.mlmodel_mixin import OMetaMlModelMixin
|
||||||
from metadata.ingestion.ometa.mixins.pipeline_mixin import OMetaPipelineMixin
|
from metadata.ingestion.ometa.mixins.pipeline_mixin import OMetaPipelineMixin
|
||||||
from metadata.ingestion.ometa.mixins.table_mixin import OMetaTableMixin
|
from metadata.ingestion.ometa.mixins.table_mixin import OMetaTableMixin
|
||||||
@ -63,7 +65,6 @@ from metadata.ingestion.ometa.utils import get_entity_type, uuid_to_str
|
|||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
# The naming convention is T for Entity Types and C for Create Types
|
# The naming convention is T for Entity Types and C for Create Types
|
||||||
T = TypeVar("T", bound=BaseModel)
|
T = TypeVar("T", bound=BaseModel)
|
||||||
C = TypeVar("C", bound=BaseModel)
|
C = TypeVar("C", bound=BaseModel)
|
||||||
@ -103,6 +104,7 @@ class OpenMetadata(
|
|||||||
OMetaTableMixin,
|
OMetaTableMixin,
|
||||||
OMetaVersionMixin,
|
OMetaVersionMixin,
|
||||||
OMetaTagMixin,
|
OMetaTagMixin,
|
||||||
|
GlossaryMixin,
|
||||||
Generic[T, C],
|
Generic[T, C],
|
||||||
):
|
):
|
||||||
"""
|
"""
|
||||||
@ -221,6 +223,9 @@ class OpenMetadata(
|
|||||||
if issubclass(entity, (Tag, TagCategory)):
|
if issubclass(entity, (Tag, TagCategory)):
|
||||||
return "/tags"
|
return "/tags"
|
||||||
|
|
||||||
|
if issubclass(entity, Glossary):
|
||||||
|
return "/glossaries"
|
||||||
|
|
||||||
if issubclass(entity, get_args(Union[Role, self.get_create_entity_type(Role)])):
|
if issubclass(entity, get_args(Union[Role, self.get_create_entity_type(Role)])):
|
||||||
return "/roles"
|
return "/roles"
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user