Datasets

Datasets

Dataset from Email upload

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

Welcome!

It looks like you're new here. Members get access to exclusive content, events, rewards, and more. Sign in or register to get started.
Sign In

Best Answer

  • 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:

    1. const axios = require('axios');
    2. // Domo API credentials
    3. const clientId = 'your_client_id';
    4. const clientSecret = 'your_client_secret';
    5. // Base URL for Domo API
    6. const baseURL = 'https://api.domo.com';
    7. // Function to authenticate and get access token
    8. async function authenticateAndGetToken() {
    9. try {
    10. const response = await axios.post(${baseURL}/oauth/token, {
    11. grant_type: 'client_credentials',
    12. client_id: clientId,
    13. client_secret: clientSecret
    14. });
    15. return response.data.access_token;
    16. } catch (error) {
    17. console.error('Error authenticating with Domo API:', error);
    18. throw error;
    19. }
    20. }
    21. // Call the function to authenticate and get token
    22. authenticateAndGetToken()
    23. .then(token => {
    24. console.log('Access token:', token);
    25. // Proceed to next steps (retrieve dataset and export)
    26. })
    27. .catch(err => console.error('Error getting access token:', err));

    And export it in javascript with something like this:

    1. // Function to export dataset data
    2. async function exportDataset(datasetId, accessToken, format) {
    3. try {
    4. const response = await axios.get(${baseURL}/v1/datasets/${datasetId}/data?format=${format}, {
    5. headers: {
    6. Authorization: Bearer ${accessToken}
    7. }
    8. });
    9. return response.data;
    10. } catch (error) {
    11. console.error('Error exporting dataset:', error);
    12. throw error;
    13. }
    14. }
    15. // Usage example: Replace your_dataset_id with the actual dataset ID
    16. const datasetId = 'your_dataset_id';
    17. const exportFormat = 'csv'; // or 'json'
    18. // Call the function to export dataset data
    19. authenticateAndGetToken()
    20. .then(token => {
    21. return exportDataset(datasetId, token, exportFormat);
    22. })
    23. .then(data => {
    24. console.log('Exported dataset:', data);
    25. // Process or save the exported data as needed
    26. })
    27. .catch(err => console.error('Error exporting dataset:', err));


    Using Python:

    1. import requests
    2. Domo API credentials
    3. client_id = 'your_client_id'
    4. client_secret = 'your_client_secret'
    5. Base URL for Domo API
    6. base_url = 'https://api.domo.com'
    7. Function to authenticate and get access token
    8. def authenticate_and_get_token():
    9. url = f'{base_url}/oauth/token'
    10. headers = {
    11. 'Content-Type': 'application/json'
    12. }
    13. data = {
    14. 'grant_type': 'client_credentials',
    15. 'client_id': client_id,
    16. 'client_secret': client_secret
    17. }
    18. response = requests.post(url, headers=headers, json=data)
    19. response_data = response.json()
    20. return response_data['access_token']
    21. Get access token
    22. access_token = authenticate_and_get_token()
    23. print('Access token:', access_token)

    Retrieve details:

    1. Function to retrieve dataset details
    2. def get_dataset_details(dataset_id, access_token):
    3. url = f'{base_url}/v1/datasets/{dataset_id}'
    4. headers = {
    5. 'Authorization': f'Bearer {access_token}'
    6. }
    7. response = requests.get(url, headers=headers)
    8. return response.json()
    9. Example usage: Replace your_dataset_id with the actual dataset ID
    10. dataset_id = 'your_dataset_id'
    11. dataset_details = get_dataset_details(dataset_id, access_token)
    12. print('Dataset details:', dataset_details)

    Export for import in Oracle:

    1. Function to export dataset data
    2. def export_dataset(dataset_id, access_token, format='csv'):
    3. url = f'{base_url}/v1/datasets/{dataset_id}/data?format={format}'
    4. headers = {
    5. 'Authorization': f'Bearer {access_token}'
    6. }
    7. response = requests.get(url, headers=headers)
    8. return response.json()
    9. Example usage: Replace your_dataset_id with the actual dataset ID
    10. exported_data = export_dataset(dataset_id, access_token)
    11. print('Exported dataset:', exported_data)
    12. Example of exporting to CSV file (optional)
    13. import csv
    14. csv_file = 'exported_data.csv'
    15. with open(csv_file, 'w', newline='') as f:
    16. writer = csv.writer(f)
    17. for row in exported_data['rows']:
    18. writer.writerow(row)
    19. 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.

    Screenshot 2024-07-15 at 2.21.14 PM.png

    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.

    Screenshot 2024-07-15 at 2.23.24 PM.png

    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

  • 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

  • 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

  • Member

    Thanks I will reach out to them

  • 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:

    1. const axios = require('axios');
    2. // Domo API credentials
    3. const clientId = 'your_client_id';
    4. const clientSecret = 'your_client_secret';
    5. // Base URL for Domo API
    6. const baseURL = 'https://api.domo.com';
    7. // Function to authenticate and get access token
    8. async function authenticateAndGetToken() {
    9. try {
    10. const response = await axios.post(${baseURL}/oauth/token, {
    11. grant_type: 'client_credentials',
    12. client_id: clientId,
    13. client_secret: clientSecret
    14. });
    15. return response.data.access_token;
    16. } catch (error) {
    17. console.error('Error authenticating with Domo API:', error);
    18. throw error;
    19. }
    20. }
    21. // Call the function to authenticate and get token
    22. authenticateAndGetToken()
    23. .then(token => {
    24. console.log('Access token:', token);
    25. // Proceed to next steps (retrieve dataset and export)
    26. })
    27. .catch(err => console.error('Error getting access token:', err));

    And export it in javascript with something like this:

    1. // Function to export dataset data
    2. async function exportDataset(datasetId, accessToken, format) {
    3. try {
    4. const response = await axios.get(${baseURL}/v1/datasets/${datasetId}/data?format=${format}, {
    5. headers: {
    6. Authorization: Bearer ${accessToken}
    7. }
    8. });
    9. return response.data;
    10. } catch (error) {
    11. console.error('Error exporting dataset:', error);
    12. throw error;
    13. }
    14. }
    15. // Usage example: Replace your_dataset_id with the actual dataset ID
    16. const datasetId = 'your_dataset_id';
    17. const exportFormat = 'csv'; // or 'json'
    18. // Call the function to export dataset data
    19. authenticateAndGetToken()
    20. .then(token => {
    21. return exportDataset(datasetId, token, exportFormat);
    22. })
    23. .then(data => {
    24. console.log('Exported dataset:', data);
    25. // Process or save the exported data as needed
    26. })
    27. .catch(err => console.error('Error exporting dataset:', err));


    Using Python:

    1. import requests
    2. Domo API credentials
    3. client_id = 'your_client_id'
    4. client_secret = 'your_client_secret'
    5. Base URL for Domo API
    6. base_url = 'https://api.domo.com'
    7. Function to authenticate and get access token
    8. def authenticate_and_get_token():
    9. url = f'{base_url}/oauth/token'
    10. headers = {
    11. 'Content-Type': 'application/json'
    12. }
    13. data = {
    14. 'grant_type': 'client_credentials',
    15. 'client_id': client_id,
    16. 'client_secret': client_secret
    17. }
    18. response = requests.post(url, headers=headers, json=data)
    19. response_data = response.json()
    20. return response_data['access_token']
    21. Get access token
    22. access_token = authenticate_and_get_token()
    23. print('Access token:', access_token)

    Retrieve details:

    1. Function to retrieve dataset details
    2. def get_dataset_details(dataset_id, access_token):
    3. url = f'{base_url}/v1/datasets/{dataset_id}'
    4. headers = {
    5. 'Authorization': f'Bearer {access_token}'
    6. }
    7. response = requests.get(url, headers=headers)
    8. return response.json()
    9. Example usage: Replace your_dataset_id with the actual dataset ID
    10. dataset_id = 'your_dataset_id'
    11. dataset_details = get_dataset_details(dataset_id, access_token)
    12. print('Dataset details:', dataset_details)

    Export for import in Oracle:

    1. Function to export dataset data
    2. def export_dataset(dataset_id, access_token, format='csv'):
    3. url = f'{base_url}/v1/datasets/{dataset_id}/data?format={format}'
    4. headers = {
    5. 'Authorization': f'Bearer {access_token}'
    6. }
    7. response = requests.get(url, headers=headers)
    8. return response.json()
    9. Example usage: Replace your_dataset_id with the actual dataset ID
    10. exported_data = export_dataset(dataset_id, access_token)
    11. print('Exported dataset:', exported_data)
    12. Example of exporting to CSV file (optional)
    13. import csv
    14. csv_file = 'exported_data.csv'
    15. with open(csv_file, 'w', newline='') as f:
    16. writer = csv.writer(f)
    17. for row in exported_data['rows']:
    18. writer.writerow(row)
    19. 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! **

  • Coach
    edited July 2024

    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! **

  • Member

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

  • Coach
    edited July 2024

    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! **

Welcome!

It looks like you're new here. Members get access to exclusive content, events, rewards, and more. Sign in or register to get started.
Sign In