Tag

a class based approach for interacting with Domo Datasets
token_auth = dmda.DomoTokenAuth(
    domo_instance=os.environ["DOMO_INSTANCE"],
    domo_access_token=os.environ["DOMO_ACCESS_TOKEN"],
)

await token_auth.who_am_i()

datasets = (
    await datacenter_routes.search_datacenter(
        auth=token_auth,
        entity_type="DATASET",
        # maximum = 25
    )
).response

dataset = next(
    (
        dataset
        for dataset in datasets
        if dataset["rowCount"] != 0
        # and dataset["ownedById"] == token_auth.user_id
    )
)
dataset
dataset_id = dataset["databaseId"]
dataset_id
'581b58d6-4554-46c6-b0e0-c7c2f782df90'

DatasetTags


source

DomoTags

 DomoTags (auth:domolibrary.client.DomoAuth.DomoAuth, dataset_id:str,
           parent:Any=None, tag_ls:List[str]=<factory>)

class for interacting with dataset tags


source

DomoTags_SetTagsError

 DomoTags_SetTagsError (dataset_id, res, cls_instance)

return if DatasetTags request is not successfull

# eval: false


ds_tags = DomoTags(auth=token_auth, dataset_id=dataset_id)

await ds_tags.get()
['Oct-30-2024 00:39', 'developer_documentation', 'hackercore']
today = dt.datetime.now().strftime("%b-%d-%Y %H:%M")


await ds_tags.set(
    tag_ls=["developer_documentation", "hackercore", today],
)
['Oct-30-2024 01:01', 'developer_documentation', 'hackercore']

source

DomoTags.add

 DomoTags.add (add_tag_ls:List[str], debug_api:bool=False,
               session:Optional[httpx.AsyncClient]=None)

appends tags to the list of existing dataset_tags

Type Default Details
add_tag_ls List
debug_api bool False
session Optional None
Returns List returns a list of tags
today_year = dt.datetime.today().strftime("%Y")

await ds_tags.add(add_tag_ls=[today_year])
['2024', 'Oct-30-2024 00:39', 'developer_documentation', 'hackercore']

source

DomoTags.remove

 DomoTags.remove (remove_tag_ls:List[str], debug_api:bool=False,
                  session:Optional[httpx.AsyncClient]=None)

removes tags from the existing list of dataset_tags

Type Default Details
remove_tag_ls List
debug_api bool False
session Optional None
Returns List returns a list of tags

Sample implementatioin of remove tags

# import datetime as dt


today_year = dt.datetime.today().strftime("%Y")

await ds_tags.remove(
    remove_tag_ls=[today_year],
)
['Oct-30-2024 00:39', 'developer_documentation', 'hackercore']