a function for interacting with DomoJupyter Accounts and Credentials
get_jupyter_account
basic function that uses the wraps the domojupyter get_account_property functions in a loop. Addresses an issue where sometimes DomoJupyter throws an error
Use this method to configure a dataset that retrieves a list of domains from a config instance (using config credentials). Pass an auth_enum object to enumerate different authenticaiton variations to expect in the result dataset (see example).
Theoretically, each of the enumerated auth variations should already exist in the instance.
The Config Dataset must return columns domo_instance and auth_match_col
raise if SQL query fails to return column named ‘auth_match_col’
sample implementation of get_domains_with_instance_auth
# import pandas as pdconfig_auth = dmda.DomoTokenAuth( domo_instance=os.environ['DOMO_INSTANCE'], domo_access_token=os.environ["DOMO_ACCESS_TOKEN"],)default_auth = dmda.DomoTokenAuth( domo_instance="default", domo_access_token=os.environ["DOMO_ACCESS_TOKEN"])class AuthEnum(Enum):"""enum_name must match values in auth_match_col from config_sql query""" test_1 = dmda.DomoFullAuth( domo_instance=os.environ['DOMO_INSTANCE'], domo_password=os.environ["DOMO_PASSWORD"], domo_username="jae@onyxreporting.com", ) test_0 = dmda.DomoTokenAuth( domo_instance="domo-community-test", domo_access_token=os.environ["DOMO_ACCESS_TOKEN"], ) config_1 = dmda.DomoTokenAuth( domo_instance="domo-community-config", domo_access_token=os.environ["DOMO_ACCESS_TOKEN"], ) config_0 = dmda.DomoTokenAuth( domo_instance="domo-community-config-test", domo_access_token=os.environ["DOMO_ACCESS_TOKEN"], )logger = lc.Logger(app_name="test_retrieve_company")res =await GetInstanceConfig.get_domains_with_instance_auth( config_auth=config_auth, config_dataset_id="8d2a8055-7918-4039-b67d-361647e96ea8", config_sql=""" SELECT domain as domo_instance, 'test_1' as auth_match_col, 1 as config_exception_pw from Table """, debug_prn=True, debug_log=False, debug_api=False, logger=logger, default_auth=default_auth, auth_enum=AuthEnum,)pd.DataFrame(res)# pd.DataFrame(logger.logs)
warning this token has not been validated by who_am_i, run get_auth_token first
⚙️ START - Retrieving company list
https://domo-community.domo.com/datasources/8d2a8055-7918-4039-b67d-361647e96ea8/details/overview using
SELECT domain as domo_instance, 'test_1' as auth_match_col, 1 as config_exception_pw from Table
⚙️ SUCCESS 🎉 Retrieved company list
There are 1 companies to update
retrieves Abstract Credential Store from DomoJupyter environment. expects credentials property to contain DOMO_USERNAME, DOMO_PASSWORD, or DOMO_ACCESS_TOKEN, and (optional) DOMO_INSTANCE
Type
Default
Details
account_name
str
domojupyter account to retrieve
domojupyter_fn
callable
Domo’s domojupyter module, pass in b/c can only be retrieved inside Domo jupyter notebook environment
domo_instance
NoneType
None
set the domo_instance or retrieve from the domojupyter_account credential store
retrieves Abstract Credential Store from DomoJupyter environment. expects credentials property to contain DOMO_USERNAME, DOMO_PASSWORD, or DOMO_ACCESS_TOKEN, and (optional) DOMO_INSTANCE
Type
Default
Details
account_name
str
domojupyter account to retrieve
domojupyter_fn
callable
Domo’s domojupyter module, pass in b/c can only be retrieved inside Domo jupyter notebook environment
domo_instance
NoneType
None
set the domo_instance or retrieve from the domojupyter_account credential store