Skip to content

Commit

Permalink
use common subtypes constants
Browse files Browse the repository at this point in the history
  • Loading branch information
sgomezvillamor committed Mar 5, 2025
1 parent db089a1 commit adb9679
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,15 @@ class BIContainerSubTypes(StrEnum):
MODE_COLLECTION = "Collection"


class FlowContainerSubTypes(StrEnum):
MSSQL_JOB = "Job"
MSSQL_PROCEDURE_CONTAINER = "Procedures Container"


class JobContainerSubTypes(StrEnum):
NIFI_PROCESS_GROUP = "Process Group"
MSSQL_JOBSTEP = "Job Step"
MSSQL_STORED_PROCEDURE = "Stored Procedure"


class BIAssetSubTypes(StrEnum):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@
DatabaseKey,
SchemaKey,
)
from datahub.ingestion.source.common.subtypes import (
FlowContainerSubTypes,
JobContainerSubTypes,
)
from datahub.metadata.schema_classes import (
ContainerClass,
DataFlowInfoClass,
Expand Down Expand Up @@ -215,7 +219,11 @@ def as_datajob_info_aspect(self) -> DataJobInfoClass:
@property
def as_subtypes_aspect(self) -> SubTypesClass:
assert isinstance(self.entity, (JobStep, StoredProcedure))
type = "Job Step" if isinstance(self.entity, JobStep) else "Stored Procedure"
type = (
JobContainerSubTypes.MSSQL_JOBSTEP
if isinstance(self.entity, JobStep)
else JobContainerSubTypes.MSSQL_STORED_PROCEDURE
)
return SubTypesClass(
typeNames=[type],
)
Expand Down Expand Up @@ -288,7 +296,11 @@ def as_dataflow_info_aspect(self) -> DataFlowInfoClass:
@property
def as_subtypes_aspect(self) -> SubTypesClass:
assert isinstance(self.entity, (MSSQLJob, MSSQLProceduresContainer))
type = "Job" if isinstance(self.entity, MSSQLJob) else "Procedures Container"
type = (
FlowContainerSubTypes.MSSQL_JOB
if isinstance(self.entity, MSSQLJob)
else FlowContainerSubTypes.MSSQL_PROCEDURE_CONTAINER
)
return SubTypesClass(
typeNames=[type],
)
Expand Down

0 comments on commit adb9679

Please sign in to comment.