Govern Artifact Search¶
The artifact search handler is used to search among artifacts.
Search for all the Govern Project artifacts¶
import dataikuapi
from dataikuapi.govern.artifact_search import GovernArtifactSearchQuery, GovernArtifactFilterBlueprints
host = "http(s)://DSS_HOST:DSS_PORT"
apiKey = "Your API key secret"
client = dataikuapi.GovernClient(host, apiKey)
# build a query
govern_projects_query = GovernArtifactSearchQuery(artifact_filters=[GovernArtifactFilterBlueprints(blueprint_ids=['bp.system.govern_project'])])
# build a request
request = client.new_artifact_search_request(govern_projects_query)
# perform the search (first batch)
result_1 = request.fetch_next_batch()
# continue the search (next batch)...
result_2 = request.fetch_next_batch()
Reference API doc¶
-
class
dataikuapi.govern.artifact_search.
GovernArtifactSearchRequest
(client, artifact_search_query)¶ A search request object. Do not create this directly, use
new_artifact_search_request()
and then run the query usingfetch_next_batch()
-
fetch_next_batch
(page_size=20)¶ Run the search request fetching the next batch of results. Use page_size to specify the size of the result page.
- Parameters
page_size (int) – (Optional) size of the result page, default value is set to 20.
- Returns
The response of a single fetch of the search request
- Return type
-
-
class
dataikuapi.govern.artifact_search.
GovernArtifactSearchResponse
(client, response)¶ A search request response for a single batch. Do not create this directly, use
fetch_next_batch()
.-
get_raw
()¶ Get the raw content of the search response
- Returns
the raw content of the search response as a dict
- Return type
dict
-
get_response_hits
()¶ Get the search response hits (artifacts)
- Returns
list of the search response hits (artifacts)
- Return type
list of
GovernArtifactSearchResponseHit
-
-
class
dataikuapi.govern.artifact_search.
GovernArtifactSearchResponseHit
(client, hit)¶ A search request response. Do not create this directly, use
get_response_hits()
.-
get_raw
()¶ Get the raw content of the search response hit
- Returns
the raw content of the search response hit as a dict
- Return type
dict
-
to_artifact
()¶ Gets the
GovernArtifact
corresponding to this search response hit- Returns
the custom page object
- Return type
-
-
class
dataikuapi.govern.artifact_search.
GovernArtifactSearchQuery
(artifact_search_source=None, artifact_filters=None, artifact_search_sort=None)¶ A definition of an artifact query. Instantiate and interact with this object to customize the query.
- Parameters
artifact_search_source (
GovernArtifactSearchSource
) – (Optional) The search source to target a subset of artifacts. For now, by default, the search will be executed on all artifacts using theGovernArtifactSearchSourceAll
search source.artifact_filters (list of
GovernArtifactFilter
) – A list of filters to apply on the query.artifact_search_sort (
GovernArtifactSearchSort
) – The sort configuration to apply on the query
-
set_artifact_search_source
(artifact_search_source)¶ Set a search source for this query
- Parameters
artifact_search_source (
GovernArtifactSearchSource
) – (Optional) The search source to target a subset of artifacts. For now, by default, the search will be executed on all artifacts using theGovernArtifactSearchSourceAll
search source.- Returns
None
-
clear_artifact_filters
()¶ Remove the filters set for this query
- Returns
None
-
add_artifact_filter
(artifact_filter)¶ Add a new artifact filter to the filter list of the query.
- Parameters
artifact_filter (
GovernArtifactFilter
) – A filter to add to the filter list.- Returns
None
-
clear_artifact_search_sort
()¶ Remove the sort configuration of this query.
- Returns
None
-
set_artifact_search_sort
(artifact_search_sort)¶ Set a new search sort configuration for this request.
- Parameters
artifact_search_sort (
GovernArtifactSearchSort
) – The sort configuration to apply on the query- Returns
None
-
build
()¶ - Returns
the search query definition
- Return type
(dict, dict)
-
class
dataikuapi.govern.artifact_search.
GovernArtifactSearchSource
(search_source_type)¶ An abstract class to represent the different search source. Do not instantiate this class but one of its subclasses.
-
build
()¶
-
-
class
dataikuapi.govern.artifact_search.
GovernArtifactSearchSourceAll
¶ A generic search source definition.
-
build
()¶ - Returns
the search source definition as a dict
- Return type
dict
-
-
class
dataikuapi.govern.artifact_search.
GovernArtifactSearchSort
(artifact_search_sort_type, direction)¶ An abstract class to represent the different search sort. Do not instantiate this class but one of its subclasses.
-
build
()¶
-
-
class
dataikuapi.govern.artifact_search.
GovernArtifactSearchSortName
(direction='ASC')¶ An artifact sort definition based on their names.
- Parameters
direction (str) – (Optional) The direction on which the artifacts will be sorted. Can be either “ASC” or “DESC”
-
build
()¶ - Returns
the search sort definition as a dict
- Return type
dict
-
class
dataikuapi.govern.artifact_search.
GovernArtifactSearchSortWorkflow
(direction='ASC')¶ An artifact sort defintion based on their workflow.
- Parameters
direction (str) – (Optional) The direction on which the artifacts will be sorted. Can be either “ASC” or “DESC”
-
build
()¶ - Returns
the search sort definition as a dict
- Return type
dict
-
class
dataikuapi.govern.artifact_search.
GovernArtifactSearchSortField
(fields=None, direction='ASC')¶ An artifact sort definition based on a list of fields.
- Parameters
fields (list of dict) – (Optional) A list of fields on which the artifacts will be sorted. Use
build()
to build a field based sort definition.direction (str) – (Optional) The direction on which the artifacts will be sorted. Can be either “ASC” or “DESC”
-
build
()¶ - Returns
the search sort definition as a dict
- Return type
dict
-
class
dataikuapi.govern.artifact_search.
GovernArtifactSearchSortFieldDefinition
(blueprint_id, field_id)¶ A field sort definition builder to use in a search query in order to sort on a field of a blueprint.
- Parameters
blueprint_id (str) – the Blueprint ID
field_id (str) – the field ID
-
build
()¶ - Returns
the field search sort definition
- Return type
dict
-
class
dataikuapi.govern.artifact_search.
GovernArtifactFilter
(filter_type)¶ An abstract class to represent artifact filters. Do not instance this class but one of its subclasses.
-
build
()¶
-
-
class
dataikuapi.govern.artifact_search.
GovernArtifactFilterBlueprints
(blueprint_ids=None)¶ An artifact filter definition based on a list of specific blueprints.
- Parameters
blueprint_ids – (Optional) the list of blueprint IDs to use to filter the artifacts
blueprint_ids – lsit of str
-
build
()¶ - Returns
the artifact filter definition as a dict
- Return type
dict
-
class
dataikuapi.govern.artifact_search.
GovernArtifactFilterBlueprintVersions
(blueprint_version_ids=None)¶ An artifact filter definition based on a list of specific blueprint versions.
- Parameters
blueprint_version_ids (list of dict) – (Optional) the list of blueprint version IDs to use to filter the artifacts. Use
build()
to build a blueprint version ID definition.
-
build
()¶ - Returns
the artifact filter definition as a dict
- Return type
dict
-
class
dataikuapi.govern.artifact_search.
GovernArtifactFilterArtifacts
(artifact_ids=None)¶ An artifact filter definition based on a list of specific artifacts.
- Parameters
artifact_ids (list of str) – (Optional) the list of artifacts IDs to use to filter the artifacts.
-
build
()¶ - Returns
the artifact filter definition as a dict
- Return type
dict
-
class
dataikuapi.govern.artifact_search.
GovernArtifactFilterFieldValue
(condition_type, condition=None, field_id=None, negate_condition=None, case_sensitive=None)¶ An artifact filter definition based on specific fields value.
- Parameters
condition_type (str) – the condition type of the filter. Has to be chosen from EQUALS, CONTAINS, START_WITH, END_WITH.
condition (str) – (Optional) The value on which the condition will be applied.
field_id (str) – (Optional) The ID of the field on which the condition will be applied. If not specified the filter will apply on the name.
negate_condition (boolean) – (Optional) A boolean to negate the condition. By default, the condition is not negated.
case_sensitive (str) – (Optional) Can be used to activate case-sensitive filtering. By default, filters will not be case-sensitive.
-
build
()¶ - Returns
the artifact filter definition as a dict
- Return type
dict
-
class
dataikuapi.govern.artifact_search.
GovernArtifactFilterArchivedStatus
(is_archived)¶ An artifact filter definition based on the archived status.
- Parameters
is_archived (boolean) – the value for filtering. If is_archived is set to True, all artifacts including archived ones will be part of the search result
-
build
()¶ - Returns
the artifact filter definition as a dict
- Return type
dict