Technology Blog Posts by Members
Explore a vibrant mix of technical expertise, industry insights, and tech buzz in member blogs covering SAP products, technology, and events. Get in the mix!
cancel
Showing results for 
Search instead for 
Did you mean: 
dharanidharan11
Explorer
1,659

Introduction:

In today's data-driven world, extracting data from various sources and sharing it with stakeholders is a common requirement. Recently I had to work on a requirement that required me to extract a Datasphere table and send the extract as an attachment in an email through DIC. In this blog post, let’s explore how to extract a table from SAP Datasphere, convert it to a CSV file, and send it via email using the Send Email operator in SAP Data Intelligence Cloud. Let's dive in

Connection Setup:

Configure the SMTP connection in SAP Data Intelligence Cloud. This connection type required the following parameters: Host, Port, User Authentication, and Password of the SMTP connection.

Make sure you set up the connection properly to enable email sending functionality.

dharanidharan11_0-1724665536800.png

Creating the Graph:

To accomplish this task, Let us create graph consisting of the following components: Table Consumer, Python3 operator, Send Email operator, Wiretap (optional), and Graph Terminator.

dharanidharan11_1-1724665536805.png

  1. Table Consumer Operator: The table Consumer operator is configured to select the desired table from SAP Datasphere. This operator will fetch the required table for further processing.dharanidharan11_2-1724665536807.png
  2. Python3 Operator: The output from the Table Consumer operator had to be converted into a message format. I used the 'Table to Message Converter' operator to achieve this conversion and connect its output to the input port of the Python3 operator.                                                                          Configure the input and output ports of the Python3 operator to handle messages.dharanidharan11_3-1724665536809.png
  3. Python Code: Inside the Python3 operator, the following code snippet is used to convert the message into a CSV file and attach it to an email.dharanidharan11_4-1724665536814.png
  4. Send Email Operator: Send Email operator is configured with the SMTP connection details. The output port of the Python3 operator was connected to the Send Email operator. This will pass the generated CSV file as an attachment to the email.
  5. Wiretap Operator (Optional): If you want to monitor or capture intermediate results, you can add a Wiretap operator. Connect the Send Email operator to the Wiretap operator and then to the Graph Terminator.

Executing the Graph: After configuring and connecting all the operators, save the graph and execute it. This will initiate the process of extracting the table, converting it to a CSV file, and sending it as an email attachment.

Conclusion: In this blog post, we learned how to leverage the power of SAP Data Intelligence Cloud to extract data from SAP Datasphere, convert it to a CSV file using Python, and send it via email using the Send Email operator. This functionality provides a seamless way to share data insights with stakeholders, enabling effective collaboration and decision-making. It's important to note that the provided Python code snippet is a basic example and may require modifications to suit specific use cases and environments.

 

2 Comments
Labels in this area