-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[DP-2983] Add a method for search (#3051)
* Add a method for search This method accepts a query and pagination variables, and returns the total number of results plus the results to display on the current page. For each search result, return: - the result type, DataSet or DataProduct - ID, name and description - tags - a dictionary of additional metadata fields (exactly what this will contain will depend on what tests well with users) - information about the properties which matched the search query - the time the metadata was last updated The raw responses from Datahub are logged at DEBUG level. For now I've excluded filters, facets, and sorting but these are supported by the underlying API. See - https://datahubproject.io/docs/graphql/inputObjects#facetfilterinput - https://datahubproject.io/docs/graphql/objects#facetmetadata - https://datahubproject.io/docs/graphql/inputObjects#searchsortinput * Parameterise result types in search queries
- Loading branch information
Showing
13 changed files
with
737 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 0 additions & 1 deletion
1
python-libraries/data-platform-catalogue/data_platform_catalogue/__init__.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,3 @@ | ||
from .client import DataHubCatalogueClient # noqa: F401 | ||
from .client import CatalogueError, ReferencedEntityMissing # noqa: F401 | ||
from .entities import DataProductMetadata # noqa: F401 | ||
from .entities import CatalogueMetadata, DataLocation, TableMetadata # noqa: F401 |
1 change: 0 additions & 1 deletion
1
python-libraries/data-platform-catalogue/data_platform_catalogue/client/__init__.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,3 @@ | ||
from .base import BaseCatalogueClient # noqa: F401 | ||
from .base import CatalogueError # noqa: F401 | ||
from .base import ReferencedEntityMissing # noqa: F401 | ||
from .datahub import DataHubCatalogueClient # noqa: F401 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletions
1
python-libraries/data-platform-catalogue/data_platform_catalogue/client/datahub/__init__.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
from .datahub_client import DataHubCatalogueClient # noqa: F401 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
144 changes: 144 additions & 0 deletions
144
...ies/data-platform-catalogue/data_platform_catalogue/client/datahub/graphql/search.graphql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,144 @@ | ||
query Search( | ||
$query: String! | ||
$count: Int! | ||
$start: Int! | ||
$types: [EntityType!] | ||
) { | ||
searchAcrossEntities( | ||
input: { types: $types, query: $query, start: $start, count: $count } | ||
) { | ||
start | ||
count | ||
total | ||
searchResults { | ||
insights { | ||
text | ||
} | ||
matchedFields { | ||
name | ||
value | ||
} | ||
entity { | ||
type | ||
... on Dataset { | ||
urn | ||
type | ||
platform { | ||
name | ||
} | ||
ownership { | ||
owners { | ||
owner { | ||
... on CorpUser { | ||
urn | ||
properties { | ||
fullName | ||
} | ||
} | ||
... on CorpGroup { | ||
urn | ||
properties { | ||
displayName | ||
} | ||
} | ||
} | ||
} | ||
} | ||
name | ||
properties { | ||
name | ||
qualifiedName | ||
description | ||
customProperties { | ||
key | ||
value | ||
} | ||
created | ||
lastModified | ||
} | ||
editableProperties { | ||
description | ||
} | ||
tags { | ||
tags { | ||
tag { | ||
urn | ||
properties { | ||
name | ||
description | ||
} | ||
} | ||
} | ||
} | ||
lastIngested | ||
domain { | ||
domain { | ||
urn | ||
id | ||
properties { | ||
name | ||
description | ||
} | ||
} | ||
} | ||
} | ||
... on DataProduct { | ||
urn | ||
type | ||
ownership { | ||
owners { | ||
owner { | ||
... on CorpUser { | ||
urn | ||
properties { | ||
fullName | ||
} | ||
} | ||
... on CorpGroup { | ||
urn | ||
properties { | ||
displayName | ||
} | ||
} | ||
} | ||
} | ||
} | ||
properties { | ||
name | ||
description | ||
customProperties { | ||
key | ||
value | ||
} | ||
numAssets | ||
} | ||
domain { | ||
domain { | ||
urn | ||
id | ||
properties { | ||
name | ||
description | ||
} | ||
} | ||
} | ||
tags { | ||
tags { | ||
tag { | ||
urn | ||
properties { | ||
name | ||
description | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} |
Oops, something went wrong.