Is there a way to track which DOMO assets (cards, datasets, dataflow, etc) uses a specific field?

Jarren
Jarren Member

We found the Card Fields & Beast Modes Governance dataset which shows what fields are being used in cards and beast modes but we would like to track a field name from it's original dataset > name change (if it applies) > DOMO asset.

Best Answers

  • GrantSmith
    GrantSmith Coach
    Answer ✓

    There isn't a specific dataset that would track this information. You'd have to get the card definition yourself to see if there is a field rename happening utilizing something like the java CLI with the backup-card command but that will only get your the JSON definition in a file and not as a dataset.

    **Was this post helpful? Click Agree or Like below**
    **Did this solve your problem? Accept it as a solution!**
  • ArborRose
    ArborRose Coach
    Answer ✓

    Good question @Jarren. Expanding on what Grant suggested, you might be able to poll Domo via Python or other method. Something like this would give you a list of things affected by a rename.

    import requests
    import json


    # Replace with your Domo credentials and API endpoints
    client_id = 'YOUR_CLIENT_ID'
    client_secret = 'YOUR_CLIENT_SECRET'
    api_url = 'https://api.domo.com/v1/'


    def get_access_token(client_id, client_secret):
    auth_url = 'https://api.domo.com/oauth/token?grant_type=client_credentials'
    response = requests.post(auth_url, auth=(client_id, client_secret))
    response_data = response.json()
    return response_data['access_token']


    def get_datasets(access_token):
    datasets_url = f'{api_url}datasets'
    headers = {'Authorization': f'Bearer {access_token}'}
    response = requests.get(datasets_url, headers=headers)
    return response.json()


    def get_cards(access_token):
    cards_url = f'{api_url}cards'
    headers = {'Authorization': f'Bearer {access_token}'}
    response = requests.get(cards_url, headers=headers)
    return response.json()


    def get_beast_modes(access_token):
    beast_modes_url = f'{api_url}beastmodes'
    headers = {'Authorization': f'Bearer {access_token}'}
    response = requests.get(beast_modes_url, headers=headers)
    return response.json()


    def find_field_usage(field_name, datasets, cards, beast_modes):
    # Check datasets
    for dataset in datasets['data']:
    dataset_id = dataset['id']
    # Assume you have a way to fetch dataset schema
    schema = get_dataset_schema(access_token, dataset_id)
    for field in schema['fields']:
    if field['name'] == field_name:
    print(f'Field {field_name} found in dataset {dataset_id}')

    # Check cards and beast modes similarly
    # ...


    def main():
    access_token = get_access_token(client_id, client_secret)

    datasets = get_datasets(access_token)
    cards = get_cards(access_token)
    beast_modes = get_beast_modes(access_token)

    field_name = 'your_field_name'
    find_field_usage(field_name, datasets, cards, beast_modes)


    if __name__ == '__main__':
    main()

    ** Was this post helpful? Click Agree or Like below. **
    ** Did this solve your problem? Accept it as a solution! **

Answers

  • GrantSmith
    GrantSmith Coach
    Answer ✓

    There isn't a specific dataset that would track this information. You'd have to get the card definition yourself to see if there is a field rename happening utilizing something like the java CLI with the backup-card command but that will only get your the JSON definition in a file and not as a dataset.

    **Was this post helpful? Click Agree or Like below**
    **Did this solve your problem? Accept it as a solution!**
  • Jarren
    Jarren Member

    Thanks for the response @GrantSmith

  • ArborRose
    ArborRose Coach
    Answer ✓

    Good question @Jarren. Expanding on what Grant suggested, you might be able to poll Domo via Python or other method. Something like this would give you a list of things affected by a rename.

    import requests
    import json


    # Replace with your Domo credentials and API endpoints
    client_id = 'YOUR_CLIENT_ID'
    client_secret = 'YOUR_CLIENT_SECRET'
    api_url = 'https://api.domo.com/v1/'


    def get_access_token(client_id, client_secret):
    auth_url = 'https://api.domo.com/oauth/token?grant_type=client_credentials'
    response = requests.post(auth_url, auth=(client_id, client_secret))
    response_data = response.json()
    return response_data['access_token']


    def get_datasets(access_token):
    datasets_url = f'{api_url}datasets'
    headers = {'Authorization': f'Bearer {access_token}'}
    response = requests.get(datasets_url, headers=headers)
    return response.json()


    def get_cards(access_token):
    cards_url = f'{api_url}cards'
    headers = {'Authorization': f'Bearer {access_token}'}
    response = requests.get(cards_url, headers=headers)
    return response.json()


    def get_beast_modes(access_token):
    beast_modes_url = f'{api_url}beastmodes'
    headers = {'Authorization': f'Bearer {access_token}'}
    response = requests.get(beast_modes_url, headers=headers)
    return response.json()


    def find_field_usage(field_name, datasets, cards, beast_modes):
    # Check datasets
    for dataset in datasets['data']:
    dataset_id = dataset['id']
    # Assume you have a way to fetch dataset schema
    schema = get_dataset_schema(access_token, dataset_id)
    for field in schema['fields']:
    if field['name'] == field_name:
    print(f'Field {field_name} found in dataset {dataset_id}')

    # Check cards and beast modes similarly
    # ...


    def main():
    access_token = get_access_token(client_id, client_secret)

    datasets = get_datasets(access_token)
    cards = get_cards(access_token)
    beast_modes = get_beast_modes(access_token)

    field_name = 'your_field_name'
    find_field_usage(field_name, datasets, cards, beast_modes)


    if __name__ == '__main__':
    main()

    ** Was this post helpful? Click Agree or Like below. **
    ** Did this solve your problem? Accept it as a solution! **

  • Jarren
    Jarren Member

    Wow! Thanks @ArborRose! I'll give this a try