Skip to content

Commit

Permalink
Merge branch 'master' into pluginv2
Browse files Browse the repository at this point in the history
  • Loading branch information
vishalkSimplify authored Jul 22, 2023
2 parents cfff6ec + 056d361 commit db8d7bd
Show file tree
Hide file tree
Showing 22 changed files with 741 additions and 257 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ public CompletableFuture<BrowseResultsV2> get(DataFetchingEnvironment environmen
final int start = input.getStart() != null ? input.getStart() : DEFAULT_START;
final int count = input.getCount() != null ? input.getCount() : DEFAULT_COUNT;
final String query = input.getQuery() != null ? input.getQuery() : "*";
// escape forward slash since it is a reserved character in Elasticsearch
final String sanitizedQuery = ResolverUtils.escapeForwardSlash(query);

return CompletableFuture.supplyAsync(() -> {
try {
Expand All @@ -64,7 +66,7 @@ public CompletableFuture<BrowseResultsV2> get(DataFetchingEnvironment environmen
maybeResolvedView != null
? SearchUtils.combineFilters(filter, maybeResolvedView.getDefinition().getFilter())
: filter,
query,
sanitizedQuery,
start,
count,
context.getAuthentication()
Expand Down
21 changes: 17 additions & 4 deletions datahub-web-react/src/app/home/AcrylDemoBanner.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,17 @@ const StyledLink = styled(Link)`
font-weight: 700;
`;

const TextContent = styled.div`
max-width: 1025px;
`;

export default function AcrylDemoBanner() {
return (
<BannerWrapper>
<Logo src={AcrylLogo} />
<TextWrapper>
<Title>Schedule a Demo of Managed Datahub</Title>
<span>
<Title>Schedule a Demo of Managed DataHub</Title>
<TextContent>
DataHub is already the industry&apos;s #1 Open Source Data Catalog.{' '}
<StyledLink
href="https://www.acryldata.io/datahub-sign-up"
Expand All @@ -48,8 +52,17 @@ export default function AcrylDemoBanner() {
>
Schedule a demo
</StyledLink>{' '}
of Acryl Cloud to see the advanced features that take it to the next level!
</span>
of Acryl DataHub to see the advanced features that take it to the next level or purchase Acryl Cloud
on{' '}
<StyledLink
href="https://aws.amazon.com/marketplace/pp/prodview-ratzv4k453pck?sr=0-1&ref_=beagle&applicationId=AWSMPContessa"
target="_blank"
rel="noopener noreferrer"
>
AWS Marketplace
</StyledLink>
!
</TextContent>
</TextWrapper>
</BannerWrapper>
);
Expand Down
2 changes: 2 additions & 0 deletions docs/how/updating-datahub.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ individually enable / disable desired field metrics.

### Deprecations

- #8198: In the Python SDK, the `PlatformKey` class has been renamed to `ContainerKey`.

### Other notable Changes

## 0.10.4
Expand Down
21 changes: 19 additions & 2 deletions metadata-ingestion/src/datahub/emitter/mce_builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,17 @@
import time
from enum import Enum
from hashlib import md5
from typing import Any, List, Optional, Type, TypeVar, Union, cast, get_type_hints
from typing import (
TYPE_CHECKING,
Any,
List,
Optional,
Type,
TypeVar,
Union,
cast,
get_type_hints,
)

import typing_inspect

Expand Down Expand Up @@ -50,6 +60,9 @@
os.getenv("DATAHUB_DATASET_URN_TO_LOWER", "false") == "true"
)

if TYPE_CHECKING:
from datahub.emitter.mcp_builder import DatahubKey


# TODO: Delete this once lower-casing is the standard.
def set_dataset_urn_to_lower(value: bool) -> None:
Expand Down Expand Up @@ -132,7 +145,11 @@ def dataset_key_to_urn(key: DatasetKeyClass) -> str:
)


def make_container_urn(guid: str) -> str:
def make_container_urn(guid: Union[str, "DatahubKey"]) -> str:
from datahub.emitter.mcp_builder import DatahubKey

if isinstance(guid, DatahubKey):
guid = guid.guid()
return f"urn:li:container:{guid}"


Expand Down
29 changes: 18 additions & 11 deletions metadata-ingestion/src/datahub/emitter/mcp_builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,9 @@ def guid(self) -> str:
return _stable_guid_from_dict(bag)


class PlatformKey(DatahubKey):
class ContainerKey(DatahubKey):
"""Base class for container guid keys. Most users should use one of the subclasses instead."""

platform: str
instance: Optional[str] = None

Expand All @@ -81,20 +83,27 @@ def guid_dict(self) -> Dict[str, str]:
def property_dict(self) -> Dict[str, str]:
return self.dict(by_alias=True, exclude_none=True)

def as_urn(self) -> str:
return make_container_urn(guid=self.guid())


# DEPRECATION: Keeping the `PlatformKey` name around for backwards compatibility.
PlatformKey = ContainerKey


class DatabaseKey(PlatformKey):
class DatabaseKey(ContainerKey):
database: str


class SchemaKey(DatabaseKey):
db_schema: str = Field(alias="schema")


class ProjectIdKey(PlatformKey):
class ProjectIdKey(ContainerKey):
project_id: str


class MetastoreKey(PlatformKey):
class MetastoreKey(ContainerKey):
metastore: str


Expand All @@ -110,11 +119,11 @@ class BigQueryDatasetKey(ProjectIdKey):
dataset_id: str


class FolderKey(PlatformKey):
class FolderKey(ContainerKey):
folder_abs_path: str


class BucketKey(PlatformKey):
class BucketKey(ContainerKey):
bucket_name: str


Expand All @@ -127,7 +136,7 @@ def default(self, obj: Any) -> Any:
return json.JSONEncoder.default(self, obj)


KeyType = TypeVar("KeyType", bound=PlatformKey)
KeyType = TypeVar("KeyType", bound=ContainerKey)


def add_domain_to_entity_wu(
Expand Down Expand Up @@ -188,7 +197,7 @@ def gen_containers(
container_key: KeyType,
name: str,
sub_types: List[str],
parent_container_key: Optional[PlatformKey] = None,
parent_container_key: Optional[ContainerKey] = None,
extra_properties: Optional[Dict[str, str]] = None,
domain_urn: Optional[str] = None,
description: Optional[str] = None,
Expand All @@ -199,9 +208,7 @@ def gen_containers(
created: Optional[int] = None,
last_modified: Optional[int] = None,
) -> Iterable[MetadataWorkUnit]:
container_urn = make_container_urn(
guid=container_key.guid(),
)
container_urn = container_key.as_urn()
yield MetadataChangeProposalWrapper(
entityUrn=f"{container_urn}",
# entityKeyAspect=ContainerKeyClass(guid=parent_container_key.guid()),
Expand Down
13 changes: 7 additions & 6 deletions metadata-ingestion/src/datahub/ingestion/graph/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,12 @@ class RemovedStatusFilter(enum.Enum):
"""Search only soft-deleted entities."""


@dataclass
class RelatedEntity:
urn: str
relationship_type: str


def _graphql_entity_type(entity_type: str) -> str:
"""Convert the entity types into GraphQL "EntityType" enum values."""

Expand Down Expand Up @@ -769,11 +775,6 @@ class RelationshipDirection(str, enum.Enum):
INCOMING = "INCOMING"
OUTGOING = "OUTGOING"

@dataclass
class RelatedEntity:
urn: str
relationship_type: str

def get_related_entities(
self,
entity_urn: str,
Expand All @@ -794,7 +795,7 @@ def get_related_entities(
},
)
for related_entity in response.get("entities", []):
yield DataHubGraph.RelatedEntity(
yield RelatedEntity(
urn=related_entity["urn"],
relationship_type=related_entity["relationshipType"],
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
set_dataset_urn_to_lower,
)
from datahub.emitter.mcp import MetadataChangeProposalWrapper
from datahub.emitter.mcp_builder import BigQueryDatasetKey, PlatformKey, ProjectIdKey
from datahub.emitter.mcp_builder import BigQueryDatasetKey, ContainerKey, ProjectIdKey
from datahub.ingestion.api.common import PipelineContext
from datahub.ingestion.api.decorators import (
SupportStatus,
Expand Down Expand Up @@ -434,7 +434,7 @@ def get_dataplatform_instance_aspect(
entityUrn=dataset_urn, aspect=aspect
).as_workunit()

def gen_dataset_key(self, db_name: str, schema: str) -> PlatformKey:
def gen_dataset_key(self, db_name: str, schema: str) -> ContainerKey:
return BigQueryDatasetKey(
project_id=db_name,
dataset_id=schema,
Expand All @@ -443,7 +443,7 @@ def gen_dataset_key(self, db_name: str, schema: str) -> PlatformKey:
backcompat_env_as_instance=True,
)

def gen_project_id_key(self, database: str) -> PlatformKey:
def gen_project_id_key(self, database: str) -> ContainerKey:
return ProjectIdKey(
project_id=database,
platform=self.platform,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@

from datahub.emitter.mcp_builder import (
BucketKey,
ContainerKey,
FolderKey,
KeyType,
PlatformKey,
add_dataset_to_container,
gen_containers,
)
Expand Down Expand Up @@ -45,7 +45,7 @@ def create_emit_containers(
container_key: KeyType,
name: str,
sub_types: List[str],
parent_container_key: Optional[PlatformKey] = None,
parent_container_key: Optional[ContainerKey] = None,
domain_urn: Optional[str] = None,
) -> Iterable[MetadataWorkUnit]:
if container_key.guid() not in self.processed_containers:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import datahub.emitter.mce_builder as builder
import datahub.ingestion.source.powerbi.rest_api_wrapper.data_classes as powerbi_data_classes
from datahub.emitter.mcp import MetadataChangeProposalWrapper
from datahub.emitter.mcp_builder import PlatformKey, gen_containers
from datahub.emitter.mcp_builder import ContainerKey, gen_containers
from datahub.ingestion.api.common import PipelineContext
from datahub.ingestion.api.decorators import (
SourceCapability,
Expand Down Expand Up @@ -104,7 +104,7 @@ def __init__(
self.__reporter = reporter
self.__dataplatform_instance_resolver = dataplatform_instance_resolver
self.processed_datasets: Set[powerbi_data_classes.PowerBIDataset] = set()
self.workspace_key: PlatformKey
self.workspace_key: ContainerKey

@staticmethod
def urn_to_lowercase(value: str, flag: bool) -> str:
Expand Down Expand Up @@ -256,7 +256,6 @@ def to_datahub_schema(
self,
table: powerbi_data_classes.Table,
) -> SchemaMetadataClass:

fields = []
table_fields = (
[self.to_datahub_schema_field(column) for column in table.columns]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from enum import Enum
from typing import Any, Dict, List, Optional, Union

from datahub.emitter.mcp_builder import PlatformKey
from datahub.emitter.mcp_builder import ContainerKey
from datahub.metadata.schema_classes import (
BooleanTypeClass,
DateTypeClass,
Expand All @@ -28,11 +28,11 @@
}


class WorkspaceKey(PlatformKey):
class WorkspaceKey(ContainerKey):
workspace: str


class DatasetKey(PlatformKey):
class DatasetKey(ContainerKey):
dataset: str


Expand All @@ -57,7 +57,7 @@ def get_workspace_key(
platform_name: str,
platform_instance: Optional[str] = None,
workspace_id_as_urn_part: Optional[bool] = False,
) -> PlatformKey:
) -> ContainerKey:
return WorkspaceKey(
workspace=self.get_urn_part(workspace_id_as_urn_part),
platform=platform_name,
Expand Down Expand Up @@ -150,7 +150,7 @@ def __eq__(self, instance):
def __hash__(self):
return hash(self.__members())

def get_dataset_key(self, platform_name: str) -> PlatformKey:
def get_dataset_key(self, platform_name: str) -> ContainerKey:
return DatasetKey(
dataset=self.id,
platform=platform_name,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,6 @@ class Constant:
Constant.LINKED_REPORTS: "{PBIRS_BASE_URL}/LinkedReports",
Constant.LINKED_REPORT: "{PBIRS_BASE_URL}/LinkedReports({LINKED_REPORT_ID})",
Constant.ME: "{PBIRS_BASE_URLL}/Me",
Constant.MOBILE_REPORTS: "{PBIRS_BASE_URL}/MobileReports",
Constant.MOBILE_REPORT: "{PBIRS_BASE_URL}/MobileReports({MOBILE_REPORT_ID})",
Constant.POWERBI_REPORTS: "{PBIRS_BASE_URL}/PowerBiReports",
Constant.POWERBI_REPORT: "{PBIRS_BASE_URL}/PowerBiReports({POWERBI_REPORT_ID})",
Constant.POWERBI_REPORT_DATASOURCES: "{PBIRS_BASE_URL}/PowerBiReports({ID})/DataSources",
Expand Down
Loading

0 comments on commit db8d7bd

Please sign in to comment.