Dataset from Email upload

Bishwa
Bishwa Member

I have a dataset which is uploaded everyday via email upload.

Where can I find the path of this dataset in Domo so that I can import it to Oracle?

Thanks

Best Answer

  • ArborRose
    ArborRose Coach
    Answer ✓

    I'm not sure of the question.

    A dataset in Domo is identifiable from its ID number. Open the dataset in Data and look at the URL. There will be a number there. That's the unique id for the dataset. Programmatically could access that data and pass it over to Oracle.

    For Domo "token" information look for the pages on developer.Domo.com to create a client id with secret key.

    Accessing depends upon the method/language. Javascript, Python? Something like this in Javascript:

    const axios = require('axios');
    // Domo API credentials
    const clientId = 'your_client_id';
    const clientSecret = 'your_client_secret'; // Base URL for Domo API
    const baseURL = 'https://api.domo.com'; // Function to authenticate and get access token
    async function authenticateAndGetToken() {
    try {
    const response = await axios.post(${baseURL}/oauth/token, {
    grant_type: 'client_credentials',
    client_id: clientId,
    client_secret: clientSecret
    });
    return response.data.access_token;
    } catch (error) {
    console.error('Error authenticating with Domo API:', error);
    throw error;
    }
    } // Call the function to authenticate and get token
    authenticateAndGetToken()
    .then(token => {
    console.log('Access token:', token);
    // Proceed to next steps (retrieve dataset and export)
    })
    .catch(err => console.error('Error getting access token:', err));

    And export it in javascript with something like this:

    // Function to export dataset data
    async function exportDataset(datasetId, accessToken, format) {
    try {
    const response = await axios.get(${baseURL}/v1/datasets/${datasetId}/data?format=${format}, {
    headers: {
    Authorization: Bearer ${accessToken}
    }
    });
    return response.data;
    } catch (error) {
    console.error('Error exporting dataset:', error);
    throw error;
    }
    } // Usage example: Replace your_dataset_id with the actual dataset ID
    const datasetId = 'your_dataset_id';
    const exportFormat = 'csv'; // or 'json' // Call the function to export dataset data
    authenticateAndGetToken()
    .then(token => {
    return exportDataset(datasetId, token, exportFormat);
    })
    .then(data => {
    console.log('Exported dataset:', data);
    // Process or save the exported data as needed
    })
    .catch(err => console.error('Error exporting dataset:', err));


    Using Python:

    import requests
    Domo API credentials
    client_id = 'your_client_id'
    client_secret = 'your_client_secret' Base URL for Domo API base_url = 'https://api.domo.com' Function to authenticate and get access token def authenticate_and_get_token():
    url = f'{base_url}/oauth/token'
    headers = {
    'Content-Type': 'application/json'
    }
    data = {
    'grant_type': 'client_credentials',
    'client_id': client_id,
    'client_secret': client_secret
    }
    response = requests.post(url, headers=headers, json=data)
    response_data = response.json()
    return response_data['access_token'] Get access token access_token = authenticate_and_get_token()
    print('Access token:', access_token)

    Retrieve details:

    Function to retrieve dataset details
    def get_dataset_details(dataset_id, access_token):
    url = f'{base_url}/v1/datasets/{dataset_id}'
    headers = {
    'Authorization': f'Bearer {access_token}'
    }
    response = requests.get(url, headers=headers)
    return response.json() Example usage: Replace your_dataset_id with the actual dataset ID dataset_id = 'your_dataset_id'
    dataset_details = get_dataset_details(dataset_id, access_token)
    print('Dataset details:', dataset_details)

    Export for import in Oracle:

    Function to export dataset data
    def export_dataset(dataset_id, access_token, format='csv'):
    url = f'{base_url}/v1/datasets/{dataset_id}/data?format={format}'
    headers = {
    'Authorization': f'Bearer {access_token}'
    }
    response = requests.get(url, headers=headers)
    return response.json() Example usage: Replace your_dataset_id with the actual dataset ID exported_data = export_dataset(dataset_id, access_token)
    print('Exported dataset:', exported_data) Example of exporting to CSV file (optional) import csv csv_file = 'exported_data.csv'
    with open(csv_file, 'w', newline='') as f:
    writer = csv.writer(f)
    for row in exported_data['rows']:
    writer.writerow(row) print(f'Exported data saved to {csv_file}')

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

Answers

  • Well, you could narrow it down by filtering to Type = DataSet via Email in the Domo Datacenter.

    Then you can see the email being used in the settings of each dataset. Hopefully there aren't too many and you can find the correct one.

    I'm sure there is a way to do it using the Domo API but hopefully this will get you there quickly.

    If I solved your problem, please select "yes" above

  • Bishwa
    Bishwa Member

    Thank you for the help. But for Oracle to get this dataset we need some file location in Domo ( physical drive) where the data sits. Where to find that information?

  • Are you using the Oracle Database Writeback Tile? How are you getting the data from Domo to Oracle

    If I solved your problem, please select "yes" above

  • Bishwa
    Bishwa Member

    No I am not using Oracle Database Writeback. Oracle team wants to import it from Domo to Oracle.

  • That is beyond my skillset. Perhaps @ellibot, @GrantSmith or @ArborRose could help.

    If I solved your problem, please select "yes" above

  • Bishwa
    Bishwa Member

    Thanks I will reach out to them

  • ArborRose
    ArborRose Coach
    Answer ✓

    I'm not sure of the question.

    A dataset in Domo is identifiable from its ID number. Open the dataset in Data and look at the URL. There will be a number there. That's the unique id for the dataset. Programmatically could access that data and pass it over to Oracle.

    For Domo "token" information look for the pages on developer.Domo.com to create a client id with secret key.

    Accessing depends upon the method/language. Javascript, Python? Something like this in Javascript:

    const axios = require('axios');
    // Domo API credentials
    const clientId = 'your_client_id';
    const clientSecret = 'your_client_secret'; // Base URL for Domo API
    const baseURL = 'https://api.domo.com'; // Function to authenticate and get access token
    async function authenticateAndGetToken() {
    try {
    const response = await axios.post(${baseURL}/oauth/token, {
    grant_type: 'client_credentials',
    client_id: clientId,
    client_secret: clientSecret
    });
    return response.data.access_token;
    } catch (error) {
    console.error('Error authenticating with Domo API:', error);
    throw error;
    }
    } // Call the function to authenticate and get token
    authenticateAndGetToken()
    .then(token => {
    console.log('Access token:', token);
    // Proceed to next steps (retrieve dataset and export)
    })
    .catch(err => console.error('Error getting access token:', err));

    And export it in javascript with something like this:

    // Function to export dataset data
    async function exportDataset(datasetId, accessToken, format) {
    try {
    const response = await axios.get(${baseURL}/v1/datasets/${datasetId}/data?format=${format}, {
    headers: {
    Authorization: Bearer ${accessToken}
    }
    });
    return response.data;
    } catch (error) {
    console.error('Error exporting dataset:', error);
    throw error;
    }
    } // Usage example: Replace your_dataset_id with the actual dataset ID
    const datasetId = 'your_dataset_id';
    const exportFormat = 'csv'; // or 'json' // Call the function to export dataset data
    authenticateAndGetToken()
    .then(token => {
    return exportDataset(datasetId, token, exportFormat);
    })
    .then(data => {
    console.log('Exported dataset:', data);
    // Process or save the exported data as needed
    })
    .catch(err => console.error('Error exporting dataset:', err));


    Using Python:

    import requests
    Domo API credentials
    client_id = 'your_client_id'
    client_secret = 'your_client_secret' Base URL for Domo API base_url = 'https://api.domo.com' Function to authenticate and get access token def authenticate_and_get_token():
    url = f'{base_url}/oauth/token'
    headers = {
    'Content-Type': 'application/json'
    }
    data = {
    'grant_type': 'client_credentials',
    'client_id': client_id,
    'client_secret': client_secret
    }
    response = requests.post(url, headers=headers, json=data)
    response_data = response.json()
    return response_data['access_token'] Get access token access_token = authenticate_and_get_token()
    print('Access token:', access_token)

    Retrieve details:

    Function to retrieve dataset details
    def get_dataset_details(dataset_id, access_token):
    url = f'{base_url}/v1/datasets/{dataset_id}'
    headers = {
    'Authorization': f'Bearer {access_token}'
    }
    response = requests.get(url, headers=headers)
    return response.json() Example usage: Replace your_dataset_id with the actual dataset ID dataset_id = 'your_dataset_id'
    dataset_details = get_dataset_details(dataset_id, access_token)
    print('Dataset details:', dataset_details)

    Export for import in Oracle:

    Function to export dataset data
    def export_dataset(dataset_id, access_token, format='csv'):
    url = f'{base_url}/v1/datasets/{dataset_id}/data?format={format}'
    headers = {
    'Authorization': f'Bearer {access_token}'
    }
    response = requests.get(url, headers=headers)
    return response.json() Example usage: Replace your_dataset_id with the actual dataset ID exported_data = export_dataset(dataset_id, access_token)
    print('Exported dataset:', exported_data) Example of exporting to CSV file (optional) import csv csv_file = 'exported_data.csv'
    with open(csv_file, 'w', newline='') as f:
    writer = csv.writer(f)
    for row in exported_data['rows']:
    writer.writerow(row) print(f'Exported data saved to {csv_file}')

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

  • ArborRose
    ArborRose Coach
    edited July 15

    By the way, using Python with Domo can be done through just a script file and a computer with Python installed. I have several batch files I use to run Python scripts. Each script calls the dataset from Domo using the dataset id. My scripts generally push the data to csv or Excel files for different department using network paths. But I have also written directly into MS SQL.

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

  • Bishwa
    Bishwa Member

    Thanks ArborRose. If I need to writeback in Oracle without the Python script then do I use SFTP Writeback connector ?

  • ArborRose
    ArborRose Coach
    edited July 15

    Depends upon how you want to get the information back to Oracle. Yes, if you need to write data back into Oracle from Domo without using a Python script, one approach you can consider is using the SFTP Writeback connector in Domo.

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