Semantic models

class dataikuapi.dss.semantic_model.DSSSemanticModel(client, project_key, semantic_model_id)

A handle to interact with a semantic model.

Important

Do not create this class directly, use dataikuapi.dss.project.DSSProject.get_semantic_model() instead.

property id
get_active_version_id()

Get the active version of this semantic model.

Returns:

semantic model version handle

Return type:

dataikuapi.dss.semantic_model.DSSSemanticModelVersion

set_active_version_id(version_id)

Set the active version of this semantic model.

Parameters:

version_id (str) – identifier of the version to set as active

rename(new_name)

Rename the semantic model

Parameters:

new_name (str) – new name of the semantic model

delete()

Delete the semantic model.

list_versions_ids()

List versions of this semantic model.

Returns:

list of versions

Return type:

list[str]

get_version(version_id)

Get a handle to a specific version of this semantic model.

Parameters:

version_id (str) – identifier of the version

Returns:

semantic model version handle

Return type:

dataikuapi.dss.semantic_model.DSSSemanticModelVersion

new_version(version_id, duplicate_of=None)

Create settings for a new version of this semantic model.

The returned settings must be saved using DSSSemanticModelVersionSettings.save().

# Example usage of creating a new version

sm = project.get_semantic_model("my_semantic_model")
version_settings = sm.new_version("v2")
version_settings.save()

# Example usage of creating a new version as a duplicate of an existing version

sm = project.get_semantic_model("my_semantic_model")
version_settings = sm.new_version("v2", duplicate_of="v1")
version_settings.save()
Parameters:
  • version_id (str) – identifier for the new version

  • duplicate_of (str) – optional version id to duplicate settings from

Returns:

semantic model version settings

Return type:

dataikuapi.dss.semantic_model.DSSSemanticModelVersionSettings

class dataikuapi.dss.semantic_model.DSSSemanticModelVersion(semantic_model, version_id)

A handle to a semantic model version.

Important

Do not create this class directly, use dataikuapi.dss.semantic_model.DSSSemanticModel.get_version() instead.

property version_id
get_settings()

Get the settings of this semantic model version.

Returns:

semantic model version settings

Return type:

dataikuapi.dss.semantic_model.DSSSemanticModelVersionSettings

get_basic_distinct_values_for_attribute(entity, attribute, max_values=1000)

Get distinct values for an attribute of this semantic model version.

Parameters:
  • entity (str) – entity name

  • attribute (str) – attribute name

  • max_values (int) – maximum number of values to return

Returns:

distinct values for the attribute

Return type:

dict

get_basic_distinct_values_for_model(max_values=1000)

Get distinct values for all attributes of this semantic model version.

Parameters:

max_values (int) – maximum number of values per attribute

Returns:

distinct values for the semantic model

Return type:

dict

start_update_distinct_values()

Start updating the distinct values index for this semantic model version.

Returns:

a future tracking the update

Return type:

dataikuapi.dss.future.DSSFuture

class dataikuapi.dss.semantic_model.DSSSemanticModelVersionSettings(client, project_key, semantic_model_id, version_id, settings)

Settings of a semantic model version

Important

Do not create this class directly, use dataikuapi.dss.semanticmodel.DSSSemanticModelVersion.get_settings() instead.

static new_settings(version_id)
property id
get_raw()

Returns the raw settings of the semantic model version.

Returns:

raw settings

Return type:

dict

save()

Save the semantic model version settings.

class dataikuapi.dss.semantic_model.DSSSemanticModelListItem(client, data)

An item in a list of semantic models

Important

Do not instantiate this class directly, instead use dataikuapi.dss.project.DSSProject.list_semantic_models().

to_semantic_model()

Convert the current item to a semantic model handle.

Returns:

A handle for the semantic model.

Return type:

dataikuapi.dss.semantic_model.DSSSemanticModel

property project_key
Returns:

The project key

Return type:

string

property id
Returns:

The id of the semantic model.

Return type:

string

property name
Returns:

The name of the semantic model.

Return type:

string