Discussions

You can interact with the discussions on each DSS object through the API.

Obtaining the discussions

The first step is always to retrieve a DSSObjectDiscussions object corresponding to the DSS object your manipulating. Generally, it’s through a method called get_object_discussionss

# Get the discussions of a dataset
discussions = dataset.get_object_discussions()

# Get the discussion of a wiki article
discussions = wiki.get_article("my article").get_object_discussions()

# Get the discussions of a project
discussions = project.get_object_discussions()

# ...

List the discussions of an object

for discussion in discussions.list_discussions():
        # Discussion is a DSSDiscussion object
        print("Discussion with id: %s" % discussion.discussion_id)

Reading the messages of a discussion

for message in discussion.get_replies():
        print("Message by author %s" % message.get_author())
        print("Message posted on %s" % message.get_timestamp())
        print("Message content: %s" % message.get_text())

Adding a new message to a discussion

discussion.add_reply("hello world\n# This is Markdown")

Creating a new discussion

new_discussion = discussions.create_discussion("Topic", "Hello, this is the message")

Reference documentation

class dataikuapi.dss.discussion.DSSObjectDiscussions(client, project_key, object_type, object_id)

A handle to manage discussions on a DSS object

list_discussions()

Get the list of discussions on the object

Returns

list of discussions on the object

Return type

list of dataikuapi.dss.discussion.DSSDiscussion

create_discussion(topic, message)

Create a new discussion

Parameters
  • topic (str) – the discussion topic

  • message (str) – the markdown formatted first message

Returns

the newly created discussion

Return type

dataikuapi.dss.discussion.DSSDiscussion

get_discussion(discussion_id)

Get a specific discussion

Parameters

discussion_id (str) – the discussion ID

Returns

the discussion

Return type

dataikuapi.dss.discussion.DSSDiscussion

class dataikuapi.dss.discussion.DSSDiscussion(client, project_key, object_type, object_id, discussion_id, discussion_data, discussion_data_has_replies)

Do not call directly, use dataikuapi.dss.discussion.DSSObjectDiscussions.get_discussion()

get_metadata()

Get the discussion metadata

Returns

the discussion metadata

Return type

dict

set_metadata(discussion_metadata)

Update the discussion metadata

Parameters

discussion_metadata (dict) – the discussion metadata

get_replies()

Get the list of replies in this discussion

Returns

a list of replies

Return type

list of dataikuapi.dss.discussion.DSSDiscussionReply

add_reply(text)

Add a reply to a discussion

Parameters

text (str) – the markdown formatted text to reply

class dataikuapi.dss.discussion.DSSDiscussionReply(reply_data)

A read-only handle to access a discussion reply

get_raw_data()

Get the reply raw data

Returns

the reply data

Return type

dict

get_text()

Get the reply text

Returns

the reply text

Return type

str

get_author()

Get the reply author

Returns

the author ID

Return type

str

get_timestamp()

Get the reply timestamp

Returns

the reply timestamp

Return type

long

get_edited_timestamp()

Get the last edition timestamp

Returns

the last edition timestamp

Return type

long