Domo Python SDK
pydomo is the official Python SDK for interacting with the Domo API. It provides a convenient way to manage Domo datasets, users, groups, and more, streamlining data integration and automation workflows. The current version is 0.3.0.16, with an active but irregular release cadence focusing on bug fixes, feature parity with the R SDK, and API improvements.
Warnings
- breaking Version 0.3.0 introduced significant API refactoring. Method names were changed to align with the R SDK and a more object-oriented pattern, making primary methods available directly on the `Domo` object rather than requiring sub-objects.
- breaking From version 0.3.0, methods that download data from Domo (e.g., `datasets.get()`) now exclusively return a Pandas DataFrame. Code expecting other data structures (like lists of dictionaries) will break.
- breaking The `datasets.delete()` method (formerly `ds_delete`) introduced a mandatory confirmation prompt in v0.3.0.1. Automated scripts will hang unless `prompt_before_delete=False` is explicitly passed.
- gotcha Group management functions (`groups_add_users`, `groups_create`, `groups_list`) were significantly modified in v0.3.0.1 to fix prior incorrect behavior and align with the R SDK. Existing code using these functions might behave unexpectedly or fail.
Install
-
pip install pydomo
Imports
- Domo
from pydomo import Domo
- DomoAPIException
from pydomo.exceptions import DomoAPIException
Quickstart
import os
from pydomo import Domo
from pydomo.exceptions import DomoAPIException
# Available from environment variables or a config file
CLIENT_ID = os.environ.get('DOMO_CLIENT_ID', 'your_client_id')
CLIENT_SECRET = os.environ.get('DOMO_CLIENT_SECRET', 'your_client_secret')
API_HOST = os.environ.get('DOMO_API_HOST', 'api.domo.com') # can be overridden for sandbox etc.
if not CLIENT_ID or not CLIENT_SECRET:
print("Error: DOMO_CLIENT_ID and DOMO_CLIENT_SECRET environment variables must be set.")
exit(1)
do = Domo(CLIENT_ID, CLIENT_SECRET, api_host=API_HOST)
try:
# Example: List up to 10 datasets
datasets = do.datasets
list_of_datasets = datasets.list(limit=10)
if list_of_datasets:
print(f"Found {len(list_of_datasets)} datasets:")
for ds in list_of_datasets:
print(f" ID: {ds['id']}, Name: {ds['name']}")
else:
print("No datasets found.")
except DomoAPIException as e:
print(f"Domo API Error: {e}")
except Exception as e:
print(f"An unexpected error occurred: {e}")